Index the edge after the column that carries it exists
On a store with the old shape the table is not re-created, so an index declared beside it is built on a column the migration has not added yet.
This commit is contained in:
@@ -93,8 +93,6 @@ CREATE TABLE IF NOT EXISTS built_against (
|
|||||||
against_reference text NOT NULL,
|
against_reference text NOT NULL,
|
||||||
PRIMARY KEY (module, commit_sha, against_reference)
|
PRIMARY KEY (module, commit_sha, against_reference)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS built_against_target ON built_against (against_reference);
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// The graph first keyed its edges on a module and a commit, which the builder does not know and
|
// The graph first keyed its edges on a module and a commit, which the builder does not know and
|
||||||
@@ -107,6 +105,11 @@ DELETE FROM built_against WHERE against_reference IS NULL;
|
|||||||
ALTER TABLE built_against DROP COLUMN IF EXISTS against_module;
|
ALTER TABLE built_against DROP COLUMN IF EXISTS against_module;
|
||||||
ALTER TABLE built_against DROP COLUMN IF EXISTS against_commit;
|
ALTER TABLE built_against DROP COLUMN IF EXISTS against_commit;
|
||||||
ALTER TABLE built_against ALTER COLUMN against_reference SET NOT NULL;
|
ALTER TABLE built_against ALTER COLUMN against_reference SET NOT NULL;
|
||||||
|
|
||||||
|
-- After the column exists, and not in the schema above: on a store that still has the old shape,
|
||||||
|
-- the table is not created, so an index named in the same breath would be built on a column that
|
||||||
|
-- is not there yet.
|
||||||
|
CREATE INDEX IF NOT EXISTS built_against_target ON built_against (against_reference);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export class Graph {
|
export class Graph {
|
||||||
|
|||||||
Reference in New Issue
Block a user