Skip to content

Run generated migration in MultiDbSecondaryMigrationTest and other pertinent test file #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SOHELAHMED7 opened this issue Jun 27, 2024 · 0 comments · Fixed by #7
Closed
Assignees

Comments

@SOHELAHMED7
Copy link
Member

Run following (in Docker container)

phpunit --filter '/MultiDbSecondaryMigrationTest::testPostgresCustom$/'
cd tests
./yii migrate-pgsql

Error:

$ ./yii migrate-pgsql
Yii Migration Tool (based on Yii v2.0.50)

Total 1 new migration to be applied:
	m200000_000000_change_table_v3_pgcustom

Apply the above migration? (yes|no) [no]:yes
*** applying m200000_000000_change_table_v3_pgcustom
    > alter column json1 in table {{%v3_pgcustom}} to SET NOT NULL ... done (time: 0.000s)
    > alter column json1 in table {{%v3_pgcustom}} to SET DEFAULT '[]' ... done (time: 0.000s)
    > alter column json2 in table {{%v3_pgcustom}} to SET NOT NULL ... done (time: 0.000s)
    > alter column json2 in table {{%v3_pgcustom}} to SET DEFAULT '[]' ... done (time: 0.000s)
    > alter column json3 in table {{%v3_pgcustom}} to SET NOT NULL ... done (time: 0.000s)
    > alter column json3 in table {{%v3_pgcustom}} to SET DEFAULT '[{"foo":"foobar"},{"xxx":"yyy"}]' ... done (time: 0.000s)
    > alter column json4 in table {{%v3_pgcustom}} to SET NOT NULL ... done (time: 0.000s)
    > alter column json4 in table {{%v3_pgcustom}} to SET DEFAULT '{"foo":"bar","bar":"baz"}' ... done (time: 0.000s)
    > alter column status in table {{%v3_pgcustom}} to SET DEFAULT 'draft' ... done (time: 0.000s)
    > alter column status_x in table {{%v3_pgcustom}} to SET DEFAULT 'draft' ... done (time: 0.000s)
    > create unique index v3_pgcustom_search_gin_index on {{%v3_pgcustom}} (search) ...Exception: SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near "("
LINE 1: ...custom" USING gin(to_tsvector('english', status)) ("search")
                                                             ^
The SQL being executed was: CREATE INDEX "v3_pgcustom_search_gin_index" ON "itt_v3_pgcustom" USING gin(to_tsvector('english', status)) ("search") (/app/vendor/yiisoft/yii2/db/Schema.php:676)
#0 /app/vendor/yiisoft/yii2/db/Command.php(1325): yii\db\Schema->convertException(Object(PDOException), 'CREATE INDEX "v...')
#1 /app/vendor/yiisoft/yii2/db/Command.php(1120): yii\db\Command->internalExecute('CREATE INDEX "v...')
#2 /app/vendor/yiisoft/yii2/db/Migration.php(506): yii\db\Command->execute()
#3 /app/tests/tmp/docker_app/migrations_pgsql_db/m200000_000000_change_table_v3_pgcustom.php(20): yii\db\Migration->createIndex('v3_pgcustom_sea...', '{{%v3_pgcustom}...', 'search', 'gin(to_tsvector...')
#4 /app/vendor/yiisoft/yii2/db/Migration.php(114): m200000_000000_change_table_v3_pgcustom->safeUp()
#5 /app/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(758): yii\db\Migration->up()
#6 /app/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(216): yii\console\controllers\BaseMigrateController->migrateUp('m200000_000000_...')
#7 [internal function]: yii\console\controllers\BaseMigrateController->actionUp(0)
#8 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#9 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#10 /app/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('', Array)
#11 /app/vendor/yiisoft/yii2/base/Module.php(552): yii\console\Controller->runAction('', Array)
#12 /app/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate-pgsql', Array)
#13 /app/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('migrate-pgsql', Array)
#14 /app/vendor/yiisoft/yii2/base/Application.php(384): yii\console\Application->handleRequest(Object(yii\console\Request))
#15 /app/tests/yii(6): yii\base\Application->run()
#16 {main}
*** failed to apply m200000_000000_change_table_v3_pgcustom (time: 0.003s)


0 from 1 migrations were applied.

Migration failed. The rest of the migrations are canceled.

Fix this error.

Also run generated migrations in other pertinent tests file and checks if it runs successfully.

@SOHELAHMED7 SOHELAHMED7 self-assigned this Jun 27, 2024
@cebe cebe closed this as completed in #7 Nov 12, 2024
cebe added a commit that referenced this issue Nov 12, 2024
…ultidbsecondarymigrationtest-and-other-pertinent-test-file

Resolve: Run generated migration in MultiDbSecondaryMigrationTest and other pertinent test file #6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant