Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SOHELAHMED7 committed Sep 28, 2024
1 parent f998279 commit 4a11785
Show file tree
Hide file tree
Showing 29 changed files with 46 additions and 46 deletions.
8 changes: 4 additions & 4 deletions src/generator/default/dbmodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
*/
abstract class <?= $model->getClassName() ?> extends \yii\db\ActiveRecord
{
<?php if($scenarios = $model->getScenarios()):
foreach($scenarios as $scenario): ?>
<?php if ($scenarios = $model->getScenarios()):
foreach ($scenarios as $scenario): ?>
/**
*<?= $scenario['description'] ?>

Expand All @@ -76,7 +76,7 @@ public static function tableName()
{
return <?= var_export($model->getTableAlias()) ?>;
}
<?php if($scenarios): ?>
<?php if ($scenarios): ?>

/**
* Automatically generated scenarios from the model 'x-scenarios'.
Expand All @@ -92,7 +92,7 @@ public function scenarios()
$default = parent::scenarios()[self::SCENARIO_DEFAULT];

return [
<?php foreach($scenarios as $scenario): ?>
<?php foreach ($scenarios as $scenario): ?>
self::<?= $scenario['const'] ?> => $default,
<?php endforeach; ?>
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public function up()
0 => 'uid varchar(128) NOT NULL',
'title' => $this->string(255)->notNull(),
'slug' => $this->string(200)->null()->defaultValue(null),
'category_id' => $this->integer()->notNull(),
'category_id' => $this->integer()->notNull()->comment('Category of posts'),
'active' => $this->boolean()->notNull()->defaultValue(false),
'created_at' => $this->date()->null()->defaultValue(null),
'created_by_id' => $this->integer()->null()->defaultValue(null),
'created_by_id' => $this->integer()->null()->defaultValue(null)->comment('The User'),
]);
$this->addPrimaryKey('pk_blog_posts_uid', '{{%blog_posts}}', 'uid');
$this->createIndex('blog_posts_title_key', '{{%blog_posts}}', 'title', true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public function up()
{
$this->createTable('{{%post_comments}}', [
'id' => $this->bigPrimaryKey(),
'post_id' => $this->string(128)->notNull(),
'author_id' => $this->integer()->notNull(),
'post_id' => $this->string(128)->notNull()->comment('A blog post (uid used as pk for test purposes)'),
'author_id' => $this->integer()->notNull()->comment('The User'),
0 => 'message json NOT NULL',
1 => 'meta_data json NOT NULL',
'created_at' => $this->integer()->notNull(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public function up()
0 => 'uid varchar(128) NOT NULL',
'title' => $this->string(255)->notNull(),
'slug' => $this->string(200)->null()->defaultValue(null),
'category_id' => $this->integer()->notNull(),
'category_id' => $this->integer()->notNull()->comment('Category of posts'),
'active' => $this->boolean()->notNull()->defaultValue(false),
'created_at' => $this->date()->null()->defaultValue(null),
'created_by_id' => $this->integer()->null()->defaultValue(null),
'created_by_id' => $this->integer()->null()->defaultValue(null)->comment('The User'),
]);
$this->addPrimaryKey('pk_blog_posts_uid', '{{%blog_posts}}', 'uid');
$this->createIndex('blog_posts_title_key', '{{%blog_posts}}', 'title', true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public function up()
{
$this->createTable('{{%post_comments}}', [
'id' => $this->bigPrimaryKey(),
'post_id' => $this->string(128)->notNull(),
'author_id' => $this->integer()->notNull(),
'post_id' => $this->string(128)->notNull()->comment('A blog post (uid used as pk for test purposes)'),
'author_id' => $this->integer()->notNull()->comment('The User'),
0 => 'message json NOT NULL DEFAULT \'[]\'',
1 => 'meta_data json NOT NULL DEFAULT \'[]\'',
'created_at' => $this->integer()->notNull(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public function up()
0 => 'uid varchar(128) NOT NULL',
'title' => $this->string(255)->notNull(),
'slug' => $this->string(200)->null()->defaultValue(null),
'category_id' => $this->integer()->notNull(),
'category_id' => $this->integer()->notNull()->comment('Category of posts'),
'active' => $this->boolean()->notNull()->defaultValue(false),
'created_at' => $this->date()->null()->defaultValue(null),
'created_by_id' => $this->integer()->null()->defaultValue(null),
'created_by_id' => $this->integer()->null()->defaultValue(null)->comment('The User'),
]);
$this->addPrimaryKey('pk_blog_posts_uid', '{{%blog_posts}}', 'uid');
$this->createIndex('blog_posts_title_key', '{{%blog_posts}}', 'title', true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public function up()
{
$this->createTable('{{%post_comments}}', [
'id' => $this->bigPrimaryKey(),
'post_id' => $this->string(128)->notNull(),
'author_id' => $this->integer()->notNull(),
'post_id' => $this->string(128)->notNull()->comment('A blog post (uid used as pk for test purposes)'),
'author_id' => $this->integer()->notNull()->comment('The User'),
0 => 'message json NOT NULL',
1 => 'meta_data json NOT NULL',
'created_at' => $this->integer()->notNull(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public function safeUp()
0 => '"uid" varchar(128) NOT NULL',
'title' => $this->string(255)->notNull(),
'slug' => $this->string(200)->null()->defaultValue(null),
'category_id' => $this->integer()->notNull(),
'category_id' => $this->integer()->notNull()->comment('Category of posts'),
'active' => $this->boolean()->notNull()->defaultValue(false),
'created_at' => $this->date()->null()->defaultValue(null),
'created_by_id' => $this->integer()->null()->defaultValue(null),
'created_by_id' => $this->integer()->null()->defaultValue(null)->comment('The User'),
]);
$this->addPrimaryKey('pk_blog_posts_uid', '{{%blog_posts}}', 'uid');
$this->createIndex('blog_posts_title_key', '{{%blog_posts}}', 'title', true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public function safeUp()
{
$this->createTable('{{%post_comments}}', [
'id' => $this->bigPrimaryKey(),
'post_id' => $this->string(128)->notNull(),
'author_id' => $this->integer()->notNull(),
'post_id' => $this->string(128)->notNull()->comment('A blog post (uid used as pk for test purposes)'),
'author_id' => $this->integer()->notNull()->comment('The User'),
0 => '"message" json NOT NULL DEFAULT \'[]\'',
1 => '"meta_data" json NOT NULL DEFAULT \'[]\'',
'created_at' => $this->integer()->notNull(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public function up()
{
$this->dropForeignKey('fk_v2_comments_post_id_v2_posts_uid', '{{%v2_comments}}');
$this->dropForeignKey('fk_v2_comments_author_id_v2_users_id', '{{%v2_comments}}');
$this->addColumn('{{%v2_comments}}', 'user_id', $this->bigInteger()->null()->defaultValue(null)->after('post_id'));
$this->addColumn('{{%v2_comments}}', 'user_id', $this->bigInteger()->null()->defaultValue(null)->after('post_id')->comment('The User'));
$this->dropColumn('{{%v2_comments}}', 'author_id');
$this->alterColumn('{{%v2_comments}}', 'message', $this->text()->notNull());
$this->alterColumn('{{%v2_comments}}', 'meta_data', $this->string(300)->null()->defaultValue(''));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public function up()
{
$this->dropForeignKey('fk_v2_comments_post_id_v2_posts_uid', '{{%v2_comments}}');
$this->dropForeignKey('fk_v2_comments_author_id_v2_users_id', '{{%v2_comments}}');
$this->addColumn('{{%v2_comments}}', 'user_id', $this->bigInteger()->null()->defaultValue(null)->after('post_id'));
$this->addColumn('{{%v2_comments}}', 'user_id', $this->bigInteger()->null()->defaultValue(null)->after('post_id')->comment('The User'));
$this->dropColumn('{{%v2_comments}}', 'author_id');
$this->alterColumn('{{%v2_comments}}', 'message', $this->text()->notNull());
$this->alterColumn('{{%v2_comments}}', 'meta_data', $this->string(300)->null()->defaultValue(''));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public function safeUp()
{
$this->dropForeignKey('fk_v2_comments_author_id_v2_users_id', '{{%v2_comments}}');
$this->dropForeignKey('fk_v2_comments_post_id_v2_posts_uid', '{{%v2_comments}}');
$this->addColumn('{{%v2_comments}}', 'user_id', $this->bigInteger()->null()->defaultValue(null));
$this->addColumn('{{%v2_comments}}', 'user_id', $this->bigInteger()->null()->defaultValue(null)->comment('The User'));
$this->dropColumn('{{%v2_comments}}', 'author_id');
$this->alterColumn('{{%v2_comments}}', 'message', 'text NOT NULL USING "message"::text');
$this->alterColumn('{{%v2_comments}}', 'message', "DROP DEFAULT");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function up()
$this->createTable('{{%webhooks}}', [
'id' => $this->primaryKey(),
'name' => $this->text()->null(),
'user_id' => $this->integer()->null()->defaultValue(null),
'user_id' => $this->integer()->null()->defaultValue(null)->comment('Test model for model code generation that should not contain id column in rules'),
'redelivery_of' => $this->integer()->null()->defaultValue(null),
]);
$this->addForeignKey('fk_webhooks_user_id_users_id', '{{%webhooks}}', 'user_id', '{{%users}}', 'id');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function up()
$this->createTable('{{%webhooks}}', [
'id' => $this->primaryKey(),
'name' => $this->string(255)->null()->defaultValue(null),
'user_id' => $this->integer()->null()->defaultValue(null),
'user_id' => $this->integer()->null()->defaultValue(null)->comment('Test model for model code generation that should not contain id column in rules'),
'redelivery_of' => $this->integer()->null()->defaultValue(null),
'rd_abc_2' => $this->integer()->null()->defaultValue(null),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public function up()
{
$this->createTable('{{%accounts}}', [
'id' => $this->primaryKey(),
'name' => $this->string(128)->notNull(),
'name' => $this->string(128)->notNull()->comment('account name'),
'paymentMethodName' => $this->text()->null(),
]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public function up()
{
$this->createTable('{{%contacts}}', [
'id' => $this->primaryKey(),
'account_id' => $this->integer()->notNull(),
'account_id' => $this->integer()->notNull()->comment('Account'),
'active' => $this->boolean()->null()->defaultValue(false),
'nickname' => $this->text()->null(),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function safeUp()
$this->createTable('{{%b123s}}', [
'id' => $this->primaryKey(),
'name' => $this->text()->null()->defaultValue(null),
'c123_id' => $this->integer()->null()->defaultValue(null),
'c123_id' => $this->integer()->null()->defaultValue(null)->comment('desc'),
]);
$this->addForeignKey('fk_b123s_c123_id_c123s_id', '{{%b123s}}', 'c123_id', '{{%c123s}}', 'id');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function safeUp()
$this->createTable('{{%a123s}}', [
'id' => $this->primaryKey(),
'name' => $this->text()->null()->defaultValue(null),
'b123_id' => $this->integer()->null()->defaultValue(null),
'b123_id' => $this->integer()->null()->defaultValue(null)->comment('desc'),
]);
$this->addForeignKey('fk_a123s_b123_id_b123s_id', '{{%a123s}}', 'b123_id', '{{%b123s}}', 'id');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public function safeUp()
{
$this->createTable('{{%accounts}}', [
'id' => $this->primaryKey(),
'name' => $this->string(40)->notNull(),
'name' => $this->string(40)->notNull()->comment('account name'),
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public function safeUp()
{
$this->createTable('{{%domains}}', [
'id' => $this->primaryKey(),
'name' => $this->string(128)->notNull(),
'account_id' => $this->integer()->notNull(),
'name' => $this->string(128)->notNull()->comment('domain or sub-domain name, in DNS syntax, IDN are converted'),
'account_id' => $this->integer()->notNull()->comment('user account'),
0 => '"created_at" timestamp NOT NULL',
]);
$this->addForeignKey('fk_domains_account_id_accounts_id', '{{%domains}}', 'account_id', '{{%accounts}}', 'id');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function safeUp()
$this->createTable('{{%e123s}}', [
'id' => $this->primaryKey(),
'name' => $this->text()->null()->defaultValue(null),
'b123_id' => $this->integer()->null()->defaultValue(null),
'b123_id' => $this->integer()->null()->defaultValue(null)->comment('desc'),
]);
$this->addForeignKey('fk_e123s_b123_id_b123s_id', '{{%e123s}}', 'b123_id', '{{%b123s}}', 'id');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ public function safeUp()
{
$this->createTable('{{%routings}}', [
'id' => $this->primaryKey(),
'domain_id' => $this->integer()->notNull(),
'domain_id' => $this->integer()->notNull()->comment('domain'),
'path' => $this->string(255)->null()->defaultValue(null),
'ssl' => $this->boolean()->null()->defaultValue(null),
'redirect_to_ssl' => $this->boolean()->null()->defaultValue(null),
'service' => $this->string(255)->null()->defaultValue(null),
0 => '"created_at" timestamp NULL DEFAULT NULL',
'd123_id' => $this->integer()->null()->defaultValue(null),
'a123_id' => $this->integer()->null()->defaultValue(null),
'd123_id' => $this->integer()->null()->defaultValue(null)->comment('desc'),
'a123_id' => $this->integer()->null()->defaultValue(null)->comment('desc'),
]);
$this->addForeignKey('fk_routings_domain_id_domains_id', '{{%routings}}', 'domain_id', '{{%domains}}', 'id');
$this->addForeignKey('fk_routings_d123_id_d123s_id', '{{%routings}}', 'd123_id', '{{%d123s}}', 'id');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function up()
7 => 'col_9 varchar(9) NULL DEFAULT NULL',
8 => 'col_10 varchar(10) NULL DEFAULT NULL',
9 => 'col_11 text NULL DEFAULT NULL',
10 => 'price decimal(10,2) NULL DEFAULT 0',
10 => 'price decimal(10,2) NULL DEFAULT 0 COMMENT \'price in EUR\'',
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function up()
7 => 'col_9 varchar(9) NULL DEFAULT NULL',
8 => 'col_10 varchar(10) NULL DEFAULT NULL',
9 => 'col_11 text NULL',
10 => 'price decimal(10,2) NULL DEFAULT 0',
10 => 'price decimal(10,2) NULL DEFAULT 0 COMMENT \'price in EUR\'',
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function up()
7 => 'col_9 varchar(9) NULL DEFAULT NULL',
8 => 'col_10 varchar(10) NULL DEFAULT NULL',
9 => 'col_11 text NULL DEFAULT NULL',
10 => 'price decimal(10,2) NULL DEFAULT 0',
10 => 'price decimal(10,2) NULL DEFAULT 0 COMMENT \'price in EUR\'',
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function up()
7 => 'col_9 varchar(9) NULL DEFAULT NULL',
8 => 'col_10 varchar(10) NULL DEFAULT NULL',
9 => 'col_11 text NULL',
10 => 'price decimal(10,2) NULL DEFAULT 0',
10 => 'price decimal(10,2) NULL DEFAULT 0 COMMENT \'price in EUR\'',
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function up()
7 => 'col_9 varchar(9) NULL DEFAULT NULL',
8 => 'col_10 varchar(10) NULL DEFAULT NULL',
9 => 'col_11 text NULL DEFAULT NULL',
10 => 'price decimal(10,2) NULL DEFAULT 0',
10 => 'price decimal(10,2) NULL DEFAULT 0 COMMENT \'price in EUR\'',
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function up()
7 => 'col_9 varchar(9) NULL DEFAULT NULL',
8 => 'col_10 varchar(10) NULL DEFAULT NULL',
9 => 'col_11 text NULL',
10 => 'price decimal(10,2) NULL DEFAULT 0',
10 => 'price decimal(10,2) NULL DEFAULT 0 COMMENT \'price in EUR\'',
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ public function safeUp()
$this->createTable('{{%postxes}}', [
'id' => $this->primaryKey(),
'title' => $this->text()->null()->defaultValue(null),
'user_id' => $this->integer()->null()->defaultValue(null),
'user_2_id' => $this->integer()->null()->defaultValue(null),
'user_3_id' => $this->integer()->null()->defaultValue(null),
'user_4_id' => $this->integer()->null()->defaultValue(null),
'user_id' => $this->integer()->null()->defaultValue(null)->comment('x on-x (update|delete) foreign key constraint'),
'user_2_id' => $this->integer()->null()->defaultValue(null)->comment('x on-x (update|delete) foreign key constraint'),
'user_3_id' => $this->integer()->null()->defaultValue(null)->comment('x on-x (update|delete) foreign key constraint'),
'user_4_id' => $this->integer()->null()->defaultValue(null)->comment('x on-x (update|delete) foreign key constraint'),
]);
$this->addForeignKey('fk_postxes_user_id_userxes_id', '{{%postxes}}', 'user_id', '{{%userxes}}', 'id', null, 'CASCADE');
$this->addForeignKey('fk_postxes_user_2_id_userxes_id', '{{%postxes}}', 'user_2_id', '{{%userxes}}', 'id', 'SET NULL', 'CASCADE');
Expand Down

0 comments on commit 4a11785

Please sign in to comment.