added migrations

This commit is contained in:
Antonio Ramirez
2016-12-10 21:33:29 +01:00
parent 6d47dcaf22
commit 0faf61f044
4 changed files with 135 additions and 0 deletions

View File

@ -0,0 +1,30 @@
<?php
class m000000_000002_create_profile_table extends \yii\db\Migration
{
public function up()
{
$this->createTable(
'{{%profile}}',
[
'user_id' => $this->primaryKey(),
'name' => $this->string(255),
'public_email' => $this->string(255),
'gravatar_email' => $this->string(255),
'gravatar_id' => $this->string(32),
'location' => $this->string(255),
'website'=> $this->string(255),
'timezone' => $this->string(40),
'bio' => $this->text()
]
);
$this->addForeignKey('fk_profile_user', '{{%profile}}', 'user_id', '{{%user}}', 'id', 'CASCADE', 'RESTRICT');
}
public function down()
{
$this->dropTable('{{%profile}}');
}
}