aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/database/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/database/migrations')
-rw-r--r--pkg/database/migrations/0003_multi_conference.sql13
-rw-r--r--pkg/database/migrations/0004_user_admins.sql2
2 files changed, 15 insertions, 0 deletions
diff --git a/pkg/database/migrations/0003_multi_conference.sql b/pkg/database/migrations/0003_multi_conference.sql
new file mode 100644
index 0000000..31a1f58
--- /dev/null
+++ b/pkg/database/migrations/0003_multi_conference.sql
@@ -0,0 +1,13 @@
+-- +goose Up
+CREATE TABLE conferences (
+ id int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
+ url text NOT NULL,
+ title text,
+ venue text,
+ city text
+);
+
+TRUNCATE TABLE favourites CONTINUE IDENTITY;
+ALTER TABLE favourites ADD conference_id int NOT NULL REFERENCES conferences(id) ON DELETE CASCADE;
+ALTER TABLE favourites DROP CONSTRAINT favourites_user_id_event_guid_event_id_key;
+ALTER TABLE favourites ADD UNIQUE(user_id, event_guid, event_id, conference_id);
diff --git a/pkg/database/migrations/0004_user_admins.sql b/pkg/database/migrations/0004_user_admins.sql
new file mode 100644
index 0000000..5c4efb3
--- /dev/null
+++ b/pkg/database/migrations/0004_user_admins.sql
@@ -0,0 +1,2 @@
+-- +goose Up
+ALTER TABLE users ADD admin boolean NOT NULL DEFAULT false;