Skip to content
This repository has been archived by the owner on Mar 19, 2019. It is now read-only.

Commit

Permalink
feat: replace display_template with link_phrase and reverse_link_phrase
Browse files Browse the repository at this point in the history
  • Loading branch information
LordSputnik committed Feb 2, 2018
1 parent 9d722ae commit 8e69005
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions migrations/2018-02-02/down.sql
@@ -0,0 +1,6 @@
BEGIN;

ALTER TABLE bookbrainz.relationship_type RENAME COLUMN link_phrase TO display_template;
ALTER TABLE bookbrainz.relationship_type DROP COLUMN reverse_link_phrase;

COMMIT;
10 changes: 10 additions & 0 deletions migrations/2018-02-02/up.sql
@@ -0,0 +1,10 @@
BEGIN;

ALTER TABLE bookbrainz.relationship_type RENAME COLUMN display_template TO link_phrase;
ALTER TABLE bookbrainz.relationship_type ADD COLUMN reverse_link_phrase TEXT CHECK (reverse_link_phrase <> '');

UPDATE bookbrainz.relationship_type SET reverse_link_phrase=' ';

ALTER TABLE bookbrainz.relationship_type ALTER COLUMN reverse_link_phrase SET NOT NULL;

COMMIT;
3 changes: 2 additions & 1 deletion schemas/bookbrainz.sql
Expand Up @@ -468,7 +468,8 @@ CREATE TABLE bookbrainz.relationship_type (
id SERIAL PRIMARY KEY,
label VARCHAR(255) NOT NULL CHECK (label <> ''),
description TEXT NOT NULL CHECK (description <> ''),
display_template TEXT NOT NULL CHECK (display_template <> ''),
link_phrase TEXT NOT NULL CHECK (link_phrase <> ''),
reverse_link_phrase TEXT NOT NULL CHECK (reverse_link_phrase <> ''),
source_entity_type bookbrainz.entity_type NOT NULL,
target_entity_type bookbrainz.entity_type NOT NULL,
parent_id INT,
Expand Down

0 comments on commit 8e69005

Please sign in to comment.