project column
This commit is contained in:
@ -12,6 +12,8 @@ class m230419_100612_drop_user_card_id_column_from_manager_table extends Migrati
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->dropForeignKey('manager_user_card', 'manager');;
|
||||
$this->dropColumn('manager', 'user_card_id');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -19,5 +21,8 @@ class m230419_100612_drop_user_card_id_column_from_manager_table extends Migrati
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->addColumn('manager', 'user_card_id', $this->integer(11));
|
||||
$this->addForeignKey('manager_user_card', 'manager', 'user_card_id',
|
||||
'user_card', 'id');
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Class m230419_214147_add_user_id_column_at_manager_table
|
||||
*/
|
||||
class m230419_214147_add_user_id_column_at_manager_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->addColumn('manager', 'user_id', $this->integer(11));
|
||||
$this->addForeignKey('manager_user', 'manager', 'user_id', 'user', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropForeignKey('manager_user', 'manager');
|
||||
$this->dropColumn('manager', 'user_id');
|
||||
}
|
||||
|
||||
/*
|
||||
// Use up()/down() to run migration code without a transaction.
|
||||
public function up()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m230419_214147_add_user_id_column_at_manager_table cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Handles dropping columns from table `{{%manager_employee}}`.
|
||||
*/
|
||||
class m230419_214500_drop_user_card_id_column_from_manager_employee_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->dropForeignKey('manager_employee_user_card', 'manager_employee');
|
||||
$this->dropColumn('manager_employee', 'user_card_id');
|
||||
|
||||
$this->addColumn('manager_employee', 'employee_id', $this->integer(11));
|
||||
$this->addForeignKey('employee_user', 'manager_employee', 'employee_id', 'user', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->addColumn('manager_employee', 'user_card_id', $this->integer(11));
|
||||
$this->addForeignKey('manager_employee_user_card', 'manager_employee', 'user_card_id',
|
||||
'user_card', 'id');
|
||||
|
||||
$this->dropForeignKey('employee_user', 'manager_employee');
|
||||
$this->dropColumn('manager_employee', 'employee_id');
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Class m230419_220233_add_owner_id_column_at_project_table
|
||||
*/
|
||||
class m230419_220233_add_owner_id_column_at_project_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->addColumn('project', 'owner_id', $this->integer());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropColumn('project', 'owner_id');
|
||||
}
|
||||
|
||||
/*
|
||||
// Use up()/down() to run migration code without a transaction.
|
||||
public function up()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m230419_220233_add_owner_id_column_at_project_table cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Handles the creation of table `{{%project_column}}`.
|
||||
*/
|
||||
class m230419_223851_create_project_column_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->createTable('{{%project_column}}', [
|
||||
'id' => $this->primaryKey(),
|
||||
'title' => $this->string(255)->notNull(),
|
||||
'project_id' => $this->integer()->notNull(),
|
||||
'created_at' => $this->dateTime(),
|
||||
'updated_at' => $this->dateTime(),
|
||||
'status' => $this->integer(1)->defaultValue(1)
|
||||
]);
|
||||
|
||||
$this->addForeignKey('fk_project_column_project', 'project_column', 'project_id', 'project', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropForeignKey('fk_project_column_project', 'project_column');
|
||||
$this->dropTable('{{%project_column}}');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user