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 8b44550f06
42 changed files with 186 additions and 148 deletions

View file

@ -21,7 +21,7 @@ class CreateUserTable extends AbstractMigration
$table->addColumn('status', 'enum', [
'null' => false,
'default' => 'Active',
'values' => [ 'Active', 'Deleted', 'Suspended']
'values' => ['Active', 'Deleted', 'Suspended']
]);
$table->addColumn('password', 'string', [

View file

@ -11,11 +11,11 @@ class CreateCallbackTable extends AbstractMigration
$table->addColumn('public_id', 'string', [
'length' => 12,
'null' => false,
])->addIndex('public_id', [ 'name' => 'UNIQUE_public_id', 'unique' => true ]);
])->addIndex('public_id', ['name' => 'UNIQUE_public_id', 'unique' => true]);
$table->addColumn('userid', 'integer', [
'null' => true,
])->addForeignKey('userid', 'user', ['id'], [ 'constraint' => 'FK_user' ]);
])->addForeignKey('userid', 'user', ['id'], ['constraint' => 'FK_user']);
$table->addColumn('name', 'string', [
'length' => 64,

View file

@ -10,8 +10,12 @@ class CreateRequestMetaTable extends AbstractMigration
$table = $this->table('request_meta');
$table->addColumn('callbackid', 'integer');
$table->addForeignKey('callbackid', 'callback', [ 'id' ],
[ 'constraint' => 'FK_callback' ]);
$table->addForeignKey(
'callbackid',
'callback',
['id'],
['constraint' => 'FK_callback']
);
$table->addColumn('source_ip', 'string', [
'limit' => 50,
@ -21,7 +25,7 @@ class CreateRequestMetaTable extends AbstractMigration
$table->addColumn('method', 'enum', [
'null' => false,
'default' => 'GET',
'values' => [ 'GET', 'POST' ]
'values' => ['GET', 'POST']
]);
$table->addColumn('uri', 'string', [

View file

@ -9,8 +9,12 @@ class CreateRequestObjectTable extends AbstractMigration
{
$table = $this->table('request_object');
$table->addForeignKey('id', 'request_meta', ['id'],
[ 'constraint' => 'FK_request_meta' ]);
$table->addForeignKey(
'id',
'request_meta',
['id'],
['constraint' => 'FK_request_meta']
);
$table->addColumn('headers', 'blob', [
'null' => true,

View file

@ -8,11 +8,11 @@ class PasswordLink extends AbstractMigration
public function up()
{
$this->table('password_link')
->addColumn('public_id', 'string', ['length' => 12 ])
->addColumn('public_id', 'string', ['length' => 12])
->addColumn('user_id', 'integer')
->addForeignKey('user_id', 'user', ['id'], [ 'constraint' => 'FK_password_link_user' ])
->addColumn('date', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP' ])
->addColumn('password', 'string', [ 'limit' => 255, 'null' => true ])
->addForeignKey('user_id', 'user', ['id'], ['constraint' => 'FK_password_link_user'])
->addColumn('date', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
->addColumn('password', 'string', ['limit' => 255, 'null' => true])
->save();
}
}

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);

View file

@ -11,7 +11,7 @@ class UserType extends AbstractMigration
->addColumn('type', 'enum', [
'null' => false,
'default' => 'user',
'values' => [ 'user', 'admin' ],
'values' => ['user', 'admin'],
'after' => 'regdate'
])
->save();