@@ -6,30 +6,30 @@ |
||
6 | 6 | class m170104_26042017_user_api_tokens extends Migration |
7 | 7 | { |
8 | 8 | |
9 | - /** |
|
10 | - * @inheritdoc |
|
11 | - * Install the User, AuthRule, AuthItem, AuthItemChild, AuthAssignment tables |
|
12 | - */ |
|
9 | + /** |
|
10 | + * @inheritdoc |
|
11 | + * Install the User, AuthRule, AuthItem, AuthItemChild, AuthAssignment tables |
|
12 | + */ |
|
13 | 13 | public function safeUp() |
14 | - { |
|
14 | + { |
|
15 | 15 | $sql = "DROP TABLE IF EXISTS ".UserApiToken::tableName(); |
16 | 16 | \Yii::$app->getDb()->createCommand($sql)->execute(); |
17 | 17 | |
18 | - $this->createTable(UserApiToken::tableName(), [ |
|
19 | - 'token'=>'varchar(64) PRIMARY KEY COMMENT "The token"', |
|
20 | - 'name' => 'varchar(100) COMMENT "A name for this token"', |
|
21 | - 'user_id'=>'int COMMENT "foreign key of the user who owns this token"', |
|
22 | - 'active'=>'int not null default 0 COMMENT "whether the token is currently active, 1 is an active token, 0 is a non active token and will not produce successful requests"', |
|
23 | - 'last_used'=>'datetime COMMENT "store the date and time of the last request that used this token"', |
|
24 | - 'used_count'=>'int not null default 0 COMMENT "number of times this token has been used"', |
|
25 | - // timestamps |
|
26 | - 'created_at' => $this->createdAt(), |
|
27 | - 'updated_at' => $this->updatedAt(), |
|
28 | - ]); |
|
29 | - } |
|
18 | + $this->createTable(UserApiToken::tableName(), [ |
|
19 | + 'token'=>'varchar(64) PRIMARY KEY COMMENT "The token"', |
|
20 | + 'name' => 'varchar(100) COMMENT "A name for this token"', |
|
21 | + 'user_id'=>'int COMMENT "foreign key of the user who owns this token"', |
|
22 | + 'active'=>'int not null default 0 COMMENT "whether the token is currently active, 1 is an active token, 0 is a non active token and will not produce successful requests"', |
|
23 | + 'last_used'=>'datetime COMMENT "store the date and time of the last request that used this token"', |
|
24 | + 'used_count'=>'int not null default 0 COMMENT "number of times this token has been used"', |
|
25 | + // timestamps |
|
26 | + 'created_at' => $this->createdAt(), |
|
27 | + 'updated_at' => $this->updatedAt(), |
|
28 | + ]); |
|
29 | + } |
|
30 | 30 | |
31 | - public function safeDown() |
|
32 | - { |
|
33 | - $this->dropTable(UserApiToken::tableName()); |
|
34 | - } |
|
31 | + public function safeDown() |
|
32 | + { |
|
33 | + $this->dropTable(UserApiToken::tableName()); |
|
34 | + } |
|
35 | 35 | } |
@@ -7,17 +7,17 @@ |
||
7 | 7 | { |
8 | 8 | public function safeUp() |
9 | 9 | { |
10 | - $this->createTable(UserInvite::tableName(), [ |
|
11 | - 'token'=>'varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs PRIMARY KEY COMMENT "The token"', |
|
12 | - 'user_id'=> $this->uuid64( 'foreign key of the user who owns this token')->notNull(), |
|
13 | - // timestamps |
|
14 | - 'expires_at' => $this->dateTime(), |
|
15 | - 'created_at' => $this->createdAt(), |
|
16 | - 'updated_at' => $this->updatedAt(), |
|
17 | - // blames |
|
18 | - 'created_by' => $this->createdBy(), |
|
19 | - 'updated_by' => $this->updatedBy() |
|
20 | - ]); |
|
10 | + $this->createTable(UserInvite::tableName(), [ |
|
11 | + 'token'=>'varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs PRIMARY KEY COMMENT "The token"', |
|
12 | + 'user_id'=> $this->uuid64( 'foreign key of the user who owns this token')->notNull(), |
|
13 | + // timestamps |
|
14 | + 'expires_at' => $this->dateTime(), |
|
15 | + 'created_at' => $this->createdAt(), |
|
16 | + 'updated_at' => $this->updatedAt(), |
|
17 | + // blames |
|
18 | + 'created_by' => $this->createdBy(), |
|
19 | + 'updated_by' => $this->updatedBy() |
|
20 | + ]); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | public function safeDown() |
@@ -25,7 +25,7 @@ |
||
25 | 25 | public function safeDown() |
26 | 26 | { |
27 | 27 | $auth = neon()->authManager; |
28 | - $auth->removeAll(); |
|
28 | + $auth->removeAll(); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -5,23 +5,23 @@ |
||
5 | 5 | class m161211_160816_user_correct_current_field extends Migration |
6 | 6 | { |
7 | 7 | |
8 | - public function safeUp() |
|
9 | - { |
|
8 | + public function safeUp() |
|
9 | + { |
|
10 | 10 | /** |
11 | 11 | * fix an incorrect definition of current in the code and make the name more meaningful |
12 | 12 | */ |
13 | 13 | $table = \neon\user\models\Session::tableName(); |
14 | 14 | $this->dropColumn($table, 'current'); |
15 | 15 | $this->addColumn($table, 'current_url', $this->string(1000)->comment('The current url the user requested in this session')); |
16 | - } |
|
16 | + } |
|
17 | 17 | |
18 | - public function safeDown() |
|
19 | - { |
|
18 | + public function safeDown() |
|
19 | + { |
|
20 | 20 | /** |
21 | 21 | * revert back to the broken definition |
22 | 22 | */ |
23 | 23 | $table = \neon\user\models\Session::tableName(); |
24 | 24 | $this->dropColumn($table, 'current_url'); |
25 | 25 | $this->addColumn($table, 'current', $this->dateTime()->comment('The current url the user requested in this session')); |
26 | - } |
|
26 | + } |
|
27 | 27 | } |
@@ -5,17 +5,17 @@ |
||
5 | 5 | class m170104_161200_use_baseclass_timestamps extends Migration |
6 | 6 | { |
7 | 7 | |
8 | - public function safeUp() |
|
9 | - { |
|
8 | + public function safeUp() |
|
9 | + { |
|
10 | 10 | $table = \neon\user\models\User::tableName(); |
11 | 11 | $this->renameColumn($table, 'created_on', 'created_at'); |
12 | 12 | $this->renameColumn($table, 'updated_on', 'updated_at'); |
13 | - } |
|
13 | + } |
|
14 | 14 | |
15 | - public function safeDown() |
|
16 | - { |
|
15 | + public function safeDown() |
|
16 | + { |
|
17 | 17 | $table = \neon\user\models\User::tableName(); |
18 | 18 | $this->renameColumn($table, 'created_at', 'created_on'); |
19 | 19 | $this->renameColumn($table, 'updated_at', 'updated_on'); |
20 | - } |
|
20 | + } |
|
21 | 21 | } |
@@ -335,7 +335,7 @@ |
||
335 | 335 | * Check the system requirements |
336 | 336 | * Returns an array of tests that detect if the system meats the requirements for Neon |
337 | 337 | * |
338 | - * @return array of requirement tests: |
|
338 | + * @return array of requirement tests: |
|
339 | 339 | * for e.g: |
340 | 340 | * |
341 | 341 | * ```php |
@@ -46,7 +46,7 @@ |
||
46 | 46 | */ |
47 | 47 | public function actionMigrations() |
48 | 48 | { |
49 | - ob_start(); |
|
49 | + ob_start(); |
|
50 | 50 | $migrator = new \neon\core\db\Migrator(); |
51 | 51 | $migrator->runAllMigrations(); |
52 | 52 | $migrations = ob_get_clean(); |
@@ -301,10 +301,10 @@ |
||
301 | 301 | public function commitRequests(); |
302 | 302 | |
303 | 303 | /** |
304 | - * Extract data from the last committed requests |
|
305 | - * @param string $requestKey the request key you want to extract for |
|
306 | - * @return array the requested data or [] if none |
|
307 | - */ |
|
304 | + * Extract data from the last committed requests |
|
305 | + * @param string $requestKey the request key you want to extract for |
|
306 | + * @return array the requested data or [] if none |
|
307 | + */ |
|
308 | 308 | public function getLastCommitData($requestKey); |
309 | 309 | |
310 | 310 |
@@ -18,59 +18,59 @@ |
||
18 | 18 | */ |
19 | 19 | class DdsDataType extends \yii\db\ActiveRecord |
20 | 20 | { |
21 | - /** |
|
22 | - * @inheritdoc |
|
23 | - */ |
|
24 | - public static function tableName() |
|
25 | - { |
|
26 | - return 'dds_data_type'; |
|
27 | - } |
|
21 | + /** |
|
22 | + * @inheritdoc |
|
23 | + */ |
|
24 | + public static function tableName() |
|
25 | + { |
|
26 | + return 'dds_data_type'; |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * @inheritdoc |
|
31 | - */ |
|
32 | - public function rules() |
|
33 | - { |
|
34 | - return [ |
|
35 | - [['data_type_ref', 'storage_ref'], 'required'], |
|
36 | - [['deleted'], 'integer'], |
|
37 | - [['data_type_ref', 'storage_ref'], 'string', 'max' => 50], |
|
38 | - [['label'], 'string', 'max' => 300], |
|
39 | - [['description'], 'string', 'max' => 1000], |
|
40 | - [['definition'], 'string', 'max' => 2000], |
|
41 | - [['data_type_ref'], 'unique'], |
|
42 | - [['storage_ref'], 'exist', 'skipOnError' => true, 'targetClass' => DdsStorage::className(), 'targetAttribute' => ['storage_ref' => 'storage_ref']], |
|
43 | - ]; |
|
44 | - } |
|
29 | + /** |
|
30 | + * @inheritdoc |
|
31 | + */ |
|
32 | + public function rules() |
|
33 | + { |
|
34 | + return [ |
|
35 | + [['data_type_ref', 'storage_ref'], 'required'], |
|
36 | + [['deleted'], 'integer'], |
|
37 | + [['data_type_ref', 'storage_ref'], 'string', 'max' => 50], |
|
38 | + [['label'], 'string', 'max' => 300], |
|
39 | + [['description'], 'string', 'max' => 1000], |
|
40 | + [['definition'], 'string', 'max' => 2000], |
|
41 | + [['data_type_ref'], 'unique'], |
|
42 | + [['storage_ref'], 'exist', 'skipOnError' => true, 'targetClass' => DdsStorage::className(), 'targetAttribute' => ['storage_ref' => 'storage_ref']], |
|
43 | + ]; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * @inheritdoc |
|
48 | - */ |
|
49 | - public function attributeLabels() |
|
50 | - { |
|
51 | - return [ |
|
52 | - 'data_type_ref' => 'Data Type Ref', |
|
53 | - 'label' => 'Label', |
|
54 | - 'description' => 'Description', |
|
55 | - 'definition' => 'Definition', |
|
56 | - 'storage_ref' => 'Storage Ref', |
|
57 | - 'deleted' => 'Deleted', |
|
58 | - ]; |
|
59 | - } |
|
46 | + /** |
|
47 | + * @inheritdoc |
|
48 | + */ |
|
49 | + public function attributeLabels() |
|
50 | + { |
|
51 | + return [ |
|
52 | + 'data_type_ref' => 'Data Type Ref', |
|
53 | + 'label' => 'Label', |
|
54 | + 'description' => 'Description', |
|
55 | + 'definition' => 'Definition', |
|
56 | + 'storage_ref' => 'Storage Ref', |
|
57 | + 'deleted' => 'Deleted', |
|
58 | + ]; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @return \yii\db\ActiveQuery |
|
63 | - */ |
|
64 | - public function getStorageRef() |
|
65 | - { |
|
66 | - return $this->hasOne(DdsStorage::className(), ['storage_ref' => 'storage_ref']); |
|
67 | - } |
|
61 | + /** |
|
62 | + * @return \yii\db\ActiveQuery |
|
63 | + */ |
|
64 | + public function getStorageRef() |
|
65 | + { |
|
66 | + return $this->hasOne(DdsStorage::className(), ['storage_ref' => 'storage_ref']); |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @return \yii\db\ActiveQuery |
|
71 | - */ |
|
72 | - public function getDdsMembers() |
|
73 | - { |
|
74 | - return $this->hasMany(DdsMember::className(), ['data_type_ref' => 'data_type_ref']); |
|
75 | - } |
|
69 | + /** |
|
70 | + * @return \yii\db\ActiveQuery |
|
71 | + */ |
|
72 | + public function getDdsMembers() |
|
73 | + { |
|
74 | + return $this->hasMany(DdsMember::className(), ['data_type_ref' => 'data_type_ref']); |
|
75 | + } |
|
76 | 76 | } |