diff options
Diffstat (limited to 'util/updates/2022-08-30-tag-trait-prefs.sql')
-rw-r--r-- | util/updates/2022-08-30-tag-trait-prefs.sql | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/util/updates/2022-08-30-tag-trait-prefs.sql b/util/updates/2022-08-30-tag-trait-prefs.sql new file mode 100644 index 00000000..db2bec02 --- /dev/null +++ b/util/updates/2022-08-30-tag-trait-prefs.sql @@ -0,0 +1,23 @@ +CREATE TABLE users_prefs_tags ( + id vndbid NOT NULL, + tid vndbid NOT NULL, + spoil smallint NOT NULL, + childs boolean NOT NULL, + PRIMARY KEY(id, tid) +); + +ALTER TABLE users_prefs_tags ADD CONSTRAINT users_prefs_tags_id_fkey FOREIGN KEY (id) REFERENCES users (id) ON DELETE CASCADE; +ALTER TABLE users_prefs_tags ADD CONSTRAINT users_prefs_tags_tid_fkey FOREIGN KEY (tid) REFERENCES tags (id) ON DELETE CASCADE; + +CREATE TABLE users_prefs_traits ( + id vndbid NOT NULL, + tid vndbid NOT NULL, + spoil smallint NOT NULL, + childs boolean NOT NULL, + PRIMARY KEY(id, tid) +); + +ALTER TABLE users_prefs_traits ADD CONSTRAINT users_prefs_traits_id_fkey FOREIGN KEY (id) REFERENCES users (id) ON DELETE CASCADE; +ALTER TABLE users_prefs_traits ADD CONSTRAINT users_prefs_traits_tid_fkey FOREIGN KEY (tid) REFERENCES traits (id) ON DELETE CASCADE; + +\i sql/perms.sql |