aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/database/migrations
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2025-08-23 22:29:28 +0100
committerLeonardo Bishop <me@leonardobishop.com>2025-08-23 22:29:28 +0100
commitecc6a55aba7bb35fc778e7a53848396b88214151 (patch)
tree1b37a2dc5f4594155114da1ae0c4529d20a4c548 /pkg/database/migrations
parent8f7dec8ba6b2f9bde01afd0a110596ebbd43e0ed (diff)
Add multiple conferences feature
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;