Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Add user preferences migration scripts #65

Merged
merged 1 commit into from Feb 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions schema/20.do.user-preferences.sql
@@ -0,0 +1,23 @@
create table preference (
id serial not null,
name varchar(100) not null,
key varchar(200) not null,
description text default null,
created timestamp not null default now(),

constraint pk_preference primary key (id),
constraint uk1_preference unique (name),
constraint uk2_preference unique (key)
);

create table users_preferences (
user_id bigint not null,
preference_id int not null,
value varchar(100) not null,
created timestamp not null default now(),
updated timestamp default null,

constraint pk_users_preferences primary key (user_id, preference_id),
constraint fk1_users_preferences foreign key (user_id) references "user" (id),
constraint fk2_users_preferences foreign key (preference_id) references preference (id)
);
2 changes: 2 additions & 0 deletions schema/20.undo.user-preferences.sql
@@ -0,0 +1,2 @@
drop table users_preferences;
drop table preference;