mirror of
https://github.com/graphql-hive/console
synced 2026-04-21 14:37:17 +00:00
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: n1ru4l <14338007+n1ru4l@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
27 lines
499 B
TypeScript
27 lines
499 B
TypeScript
import { type MigrationExecutor } from '../pg-migrator';
|
|
|
|
export default {
|
|
name: '2021.12.20T14.05.30.commits-with-targets.sql',
|
|
run: ({ psql }) => psql`
|
|
--creates and fills a target_id column on commits
|
|
ALTER TABLE
|
|
commits
|
|
ADD COLUMN
|
|
target_id UUID REFERENCES targets (id) ON DELETE CASCADE;
|
|
|
|
UPDATE
|
|
commits AS c
|
|
SET
|
|
target_id = v.target_id
|
|
FROM
|
|
versions AS v
|
|
WHERE
|
|
v.commit_id = c.id;
|
|
|
|
ALTER TABLE
|
|
commits
|
|
ALTER COLUMN
|
|
target_id
|
|
SET NOT NULL;
|
|
`,
|
|
} satisfies MigrationExecutor;
|