summaryrefslogtreecommitdiff
path: root/migrations
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-10-18 23:25:21 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-10-18 23:27:21 -0400
commitd3fbecc57b5d6fa3223b945a45fe21eb78ffd49b (patch)
treec62a5cb6636d5ef942c65e369e07b77fda42784c /migrations
parent777e4281431a036eb663b5eec70f347b7425737d (diff)
Switch to blanking tombstoned data with null, not empty string.
This accomplishes two things: * It removes the need for an additional `channel_name_reservation` table, since `channel.name` now only contains non-null values for active channels, and * It nicely dovetails with the idea that `null` means an unknown value in SQL-land.
Diffstat (limited to 'migrations')
-rw-r--r--migrations/20241017005219_retain_deleted.sql23
1 files changed, 4 insertions, 19 deletions
diff --git a/migrations/20241017005219_retain_deleted.sql b/migrations/20241017005219_retain_deleted.sql
index 6205482..aed87f4 100644
--- a/migrations/20241017005219_retain_deleted.sql
+++ b/migrations/20241017005219_retain_deleted.sql
@@ -9,33 +9,18 @@ create table channel (
not null
primary key,
name text
- not null,
+ null
+ unique,
created_sequence bigint
unique
not null,
created_at text
- not null,
- unique (id, name)
+ not null
);
insert into channel (id, name, created_sequence, created_at)
select id, name, created_sequence, created_at from old_channel;
-create table channel_name_reservation (
- id text
- not null
- unique,
- name text
- not null
- unique,
- primary key (id, name),
- foreign key (id, name)
- references channel (id, name)
-);
-
-insert into channel_name_reservation (id, name)
-select id, name from old_channel;
-
create table channel_deleted (
id text
not null
@@ -64,7 +49,7 @@ create table message (
sent_at text
not null,
body text
- not null
+ null
);
insert into message (id, channel, sender, sent_sequence, sent_at, body)