Switch to storing Git repositories in a table
Rather than just storing the URL in the guix_revisions and load_new_guix_revision_jobs tables. This will help when storing more information like tags and branches in the future.
This commit is contained in:
parent
051962b54d
commit
ce4c3c6ed3
12 changed files with 246 additions and 77 deletions
27
sqitch/revert/git_repositories.sql
Normal file
27
sqitch/revert/git_repositories.sql
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
-- Revert guix-data-service:git_repositories from pg
|
||||
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE guix_revisions ADD COLUMN url character varying;
|
||||
|
||||
UPDATE guix_revisions SET url = (
|
||||
SELECT url FROM git_repositories WHERE guix_revisions.git_repository_id = git_repositories.id
|
||||
);
|
||||
|
||||
ALTER TABLE guix_revisions ALTER COLUMN url SET NOT NULL;
|
||||
|
||||
ALTER TABLE guix_revisions DROP COLUMN git_repository_id;
|
||||
|
||||
ALTER TABLE load_new_guix_revision_jobs ADD COLUMN url character varying;
|
||||
|
||||
UPDATE load_new_guix_revision_jobs SET url = (
|
||||
SELECT url FROM git_repositories WHERE load_new_guix_revision_jobs.git_repository_id = git_repositories.id
|
||||
);
|
||||
|
||||
ALTER TABLE load_new_guix_revision_jobs ALTER COLUMN url SET NOT NULL;
|
||||
|
||||
ALTER TABLE load_new_guix_revision_jobs DROP COLUMN git_repository_id;
|
||||
|
||||
DROP TABLE git_repositories;
|
||||
|
||||
COMMIT;
|
||||
Loading…
Add table
Add a link
Reference in a new issue