add new fields
This commit is contained in:
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Class m181011_142555_add_column_to_user_card
|
||||
*/
|
||||
class m181011_142555_add_column_to_user_card extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->addColumn('user_card', 'salary', $this->string(100));
|
||||
$this->addColumn('project', 'budget', $this->string(100));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropColumn('user_card', 'salary');
|
||||
$this->dropColumn('project', 'budget');
|
||||
}
|
||||
|
||||
/*
|
||||
// Use up()/down() to run migration code without a transaction.
|
||||
public function up()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m181011_142555_add_column_to_user_card cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Class m181011_143349_add_column_company_id_to_project_table
|
||||
*/
|
||||
class m181011_143349_add_column_company_id_to_project_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->addColumn('project', 'company_id', $this->integer(11));
|
||||
$this->addForeignKey(
|
||||
'project_ibfk_company',
|
||||
'project',
|
||||
'company_id',
|
||||
'company',
|
||||
'id',
|
||||
'RESTRICT',
|
||||
'CASCADE'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropForeignKey('project_ibfk_company', 'project');
|
||||
|
||||
$this->dropColumn('project', 'company_id');
|
||||
}
|
||||
|
||||
/*
|
||||
// Use up()/down() to run migration code without a transaction.
|
||||
public function up()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m181011_143349_add_column_company_id_to_project_table cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
Reference in New Issue
Block a user