The git_branches table had 'NULL' values for some commits where the branch was deleted, importantly this was the string 'NULL', not an actual NULL value. This commit fixes that, migrating the existing values to be '', and changing the relevant code. The primary key is also extended to include the datetime field, as this is important to allow a branch to be deleted twice.
11 lines
291 B
PL/PgSQL
11 lines
291 B
PL/PgSQL
-- Deploy guix-data-service:fix_null_values_in_git_branches to pg
|
|
|
|
BEGIN;
|
|
|
|
ALTER TABLE git_branches DROP CONSTRAINT git_branches_pkey;
|
|
|
|
UPDATE git_branches SET commit = '' WHERE commit = 'NULL';
|
|
|
|
ALTER TABLE git_branches ADD PRIMARY KEY (name, commit, git_repository_id, datetime);
|
|
|
|
COMMIT;
|