Archived
1
0
Fork 0

Style fixes.

This commit is contained in:
Henrik Hautakoski 2023-04-30 16:52:38 +02:00
parent a7a59b690a
commit be4950ff88
43 changed files with 187 additions and 149 deletions

View file

@ -12,7 +12,7 @@ class UserSplitName extends AbstractMigration
// Rename "name" to "firstname" and add "lastname".
$this->table('user')
->renameColumn('name', 'firstname')
->addColumn('lastname','string', [
->addColumn('lastname', 'string', [
'length' => 128,
'after' => 'firstname',
'null' => true
@ -20,7 +20,7 @@ class UserSplitName extends AbstractMigration
->save();
// Update row data, moving everything after first space to from lastname.
foreach($this->fetchAll("SELECT `id`,`firstname` FROM `user`") as $row) {
foreach ($this->fetchAll("SELECT `id`,`firstname` FROM `user`") as $row) {
$builder = $this->getQueryBuilder()->update('user')
->where(['id' => $row['id']]);
@ -31,7 +31,7 @@ class UserSplitName extends AbstractMigration
$pos = strpos($firstname, ' ');
if ($pos !== false) {
// Set everything after the first space to lastname.
$builder->set('lastname', substr($firstname, $pos+1));
$builder->set('lastname', substr($firstname, $pos + 1));
// Remove everything after first space from firstname.
$firstname = substr($firstname, 0, $pos);