Staging instance, all changes can be removed at any time

Skip to content

sql/upgrades/36: Fix name of table constraint to drop

Constraint name is task_priority_fk not task_priority_fkey.

swh-scheduler=> \d task
                                          Table "public.task"
      Column      |           Type           | Collation | Nullable |             Default              
------------------+--------------------------+-----------+----------+----------------------------------
 id               | bigint                   |           | not null | nextval('task_id_seq'::regclass)
 type             | text                     |           | not null | 
 arguments        | jsonb                    |           | not null | 
 next_run         | timestamp with time zone |           | not null | 
 current_interval | interval                 |           |          | 
 status           | task_status              |           | not null | 
 policy           | task_policy              |           | not null | 'recurring'::task_policy
 retries_left     | bigint                   |           | not null | 0
 priority         | task_priority            |           |          | 
Indexes:
    "task_pkey1" PRIMARY KEY, btree (id)
    "task_next_run_idx1" btree (next_run)
    "task_priority_idx1" btree (priority)
    "task_type_idx1" btree (type)
    "task_type_md5_idx1" btree (type, md5(arguments::text))
    "task_type_next_run_idx1" btree (type, next_run) WHERE status = 'next_run_not_scheduled'::task_status
Check constraints:
    "task_check_policy" CHECK (policy <> 'recurring'::task_policy OR current_interval IS NOT NULL)
Foreign-key constraints:
    "task_priority_fk" FOREIGN KEY (priority) REFERENCES priority_ratio(id)
    "task_type_fk" FOREIGN KEY (type) REFERENCES task_type(type)
Referenced by:
    TABLE "task_run" CONSTRAINT "task_id_fk" FOREIGN KEY (task) REFERENCES task(id)
swh@swh-toolbox-f95b8fddc-twvq4:~$ bin/migrate-scheduler-db-version.sh
WARNING:swh.core.sentry:Sentry DSN not provided, events will not be sent.
INFO:swh.core.db.db_utils:Executing migration script '/opt/swh/.local/lib/python3.10/site-packages/swh/scheduler/sql/upgrades/36.sql'
psql:/opt/swh/.local/lib/python3.10/site-packages/swh/scheduler/sql/upgrades/36.sql:10: ERROR: constraint "task_priority_fkey" of relation "task" does not exist
Traceback (most recent call last):
File "/opt/swh/.local/bin/swh", line 8, in
sys.exit(main())
File "/opt/swh/.local/lib/python3.10/site-packages/swh/core/cli/init.py", line 175, in main
return swh(auto_envvar_prefix="SWH")
File "/opt/swh/.local/lib/python3.10/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
File "/opt/swh/.local/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/opt/swh/.local/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/swh/.local/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/swh/.local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/swh/.local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/opt/swh/.local/lib/python3.10/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
File "/opt/swh/.local/lib/python3.10/site-packages/swh/core/cli/db.py", line 474, in db_upgrade
new_db_version = swh_db_upgrade(dbname, module, to_version)
File "/opt/swh/.local/lib/python3.10/site-packages/swh/core/db/db_utils.py", line 199, in swh_db_upgrade
execute_sqlfiles([sqlfile], conninfo, db_flavor)
File "/opt/swh/.local/lib/python3.10/site-packages/swh/core/db/db_utils.py", line 677, in execute_sqlfiles
subprocess.check_call(psql_command + ["-f", str(sqlfile)])
File "/usr/local/lib/python3.10/subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['psql', '--quiet', '--no-psqlrc', '-v', 'ON_ERROR_STOP=1', '-d', 'host=next-version-dbs-rw.swh-cassandra-next-version port=5432 user=swh-scheduler dbname=swh-scheduler password=4QQBg4jzjs', '-f', '/opt/swh/.local/lib/python3.10/site-packages/swh/scheduler/sql/upgrades/36.sql']' returned non-zero exit status 3.

Merge request reports

Loading