Skip to content
Prev Previous commit
Next Next commit
Merge branches 'master' and '107-migrations-are-generated-with-syntax…
…-error-and-wrong-data-type-in-mysql' of https://github.com/SOHELAHMED7/yii2-openapi into 107-migrations-are-generated-with-syntax-error-and-wrong-data-type-in-mysql
  • Loading branch information
SOHELAHMED7 committed Jan 3, 2023
commit a37e2ca333640e6f3da499ea40893cfd9828ca1b
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ class m200000_000001_change_table_editcolumns extends \yii\db\Migration
{
public function safeUp()
{
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN first_name varchar NULL DEFAULT NULL')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN json_col_def_n json NOT NULL DEFAULT \'[]\'')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN json_col_def_n_2 json NOT NULL DEFAULT \'[]\'')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN text_col_array text[] NULL DEFAULT NULL')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ALTER COLUMN dec_col SET DATA TYPE decimal(12,2) USING "dec_col"::decimal(12,2)')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN "first_name" varchar NULL DEFAULT NULL')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN "json_col_def_n" json NOT NULL DEFAULT \'[]\'')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN "json_col_def_n_2" json NOT NULL DEFAULT \'[]\'')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ADD COLUMN "text_col_array" text[] NULL DEFAULT NULL')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ALTER COLUMN "dec_col" SET DATA TYPE decimal(12,2)')->execute();
$this->alterColumn('{{%editcolumns}}', 'dec_col', "SET DEFAULT 3.14");
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ALTER COLUMN json_col SET DATA TYPE text USING "json_col"::text')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ALTER COLUMN "json_col" SET DATA TYPE text')->execute();
$this->alterColumn('{{%editcolumns}}', 'json_col', "SET NOT NULL");
$this->alterColumn('{{%editcolumns}}', 'json_col', "SET DEFAULT 'fox jumps over dog'");
$this->alterColumn('{{%editcolumns}}', 'json_col_2', "SET NOT NULL");
$this->alterColumn('{{%editcolumns}}', 'json_col_2', "SET DEFAULT '[]'");
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ALTER COLUMN "name" SET DATA TYPE varchar(254)')->execute();
$this->alterColumn('{{%editcolumns}}', 'name', "SET DEFAULT 'Horse-2'");
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ALTER COLUMN numeric_col SET DATA TYPE double precision USING "numeric_col"::double precision')->execute();
$this->db->createCommand('ALTER TABLE {{%editcolumns}} ALTER COLUMN "numeric_col" SET DATA TYPE double precision')->execute();
$this->alterColumn('{{%editcolumns}}', 'str_col_def', "SET NOT NULL");
$this->alterColumn('{{%editcolumns}}', 'str_col_def', "DROP DEFAULT");
$this->alterColumn('{{%editcolumns}}', 'string_col', 'text NULL USING "string_col"::text');
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.