Skip to content

Commit 32a9215

Browse files
fix migrations
1 parent 4a9c489 commit 32a9215

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

migrations/m240111_115911_create_users_table.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ public function up()
1313
'users',
1414
[
1515
'id' => $this->primaryKey(),
16-
'username' => $this->string(255)->notNull()->unique(),
16+
'username' => $this->string(190)->notNull()->unique(),
1717
'auth_key' => $this->string(32)->defaultValue(null),
1818
'password' => $this->string(255)->notNull(),
19-
'password_reset_token' => $this->string(255)->defaultValue(null)->unique(),
20-
'email' => $this->string(255)->notNull()->unique(),
19+
'password_reset_token' => $this->string(190)->defaultValue(null)->unique(),
20+
'email' => $this->string(190)->notNull()->unique(),
2121
'name' => $this->string(255)->notNull(),
2222
'avatar' => $this->string(255)->defaultValue(null),
2323
'city' => $this->string(150)->defaultValue(null),
2424
'birthday' => $this->dateTime()->defaultValue(null),
2525
'status' => $this->integer()->defaultValue(10),
2626
'sex' => $this->integer()->defaultValue(0),
27-
'created_at' => $this->dateTime()->defaultValue( new \yii\db\Expression('NOW()') ),
27+
'created_at' => $this->dateTime()->defaultValue( new \yii\db\Expression('CURRENT_TIMESTAMP') ),
2828
'updated_at' => $this->dateTime()
2929
]
3030
);

src/Module.php

+5
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ class Module extends \yii\base\Module
4545
* @inheritdoc
4646
*/
4747
public $controllerNamespace = 'ZakharovAndrew\user\controllers';
48+
49+
/**
50+
* @var array config access
51+
*/
52+
public $controllersAccessList = [];
4853

4954
/**
5055
* {@inheritdoc}

src/models/User.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ public function rules()
6060

6161
[['birthday', 'auth_key', 'created_at', 'updated_at'], 'safe'],
6262
[['status', 'sex'], 'integer'],
63-
[['username', 'password', 'password_reset_token', 'email', 'name', 'avatar'], 'string', 'max' => 255],
63+
[['password', 'name', 'avatar'], 'string', 'max' => 255],
64+
[['username', 'password_reset_token', 'email'], 'string', 'max' => 190],
6465
[['auth_key'], 'string', 'max' => 32],
6566
[['city'], 'string', 'max' => 150],
6667

67-
[['username'], 'unique'],
68-
[['password_reset_token'], 'unique'],
68+
[['username', 'password_reset_token'], 'unique'],
6969
];
7070
}
7171

0 commit comments

Comments
 (0)