fix: Add CASCADE for event types on deletion.
This commit is contained in:
@@ -231,14 +231,14 @@ CREATE TABLE plain_events (
|
||||
event_id integer PRIMARY KEY,
|
||||
event_type EventType NOT NULL DEFAULT 'plain' CHECK (event_type = 'plain'),
|
||||
message TEXT NOT NULL,
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type)
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE raid_events (
|
||||
event_id integer PRIMARY KEY,
|
||||
event_type EventType NOT NULL DEFAULT 'raid' CHECK (event_type = 'raid'),
|
||||
visitor_count INTEGER NOT NULL,
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type)
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE cheer_events (
|
||||
@@ -247,7 +247,7 @@ CREATE TABLE cheer_events (
|
||||
amount INTEGER NOT NULL,
|
||||
cheer_type TEXT,
|
||||
message TEXT,
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type)
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE subscriber_events (
|
||||
@@ -256,7 +256,7 @@ CREATE TABLE subscriber_events (
|
||||
subscribed_length INTEGER NOT NULL,
|
||||
tier INTEGER NOT NULL,
|
||||
message TEXT,
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type)
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -182,14 +182,14 @@ class DataModel(Registry):
|
||||
event_id integer PRIMARY KEY,
|
||||
event_type EventType NOT NULL DEFAULT 'plain' CHECK (event_type = 'plain'),
|
||||
message TEXT NOT NULL,
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type)
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE raid_events (
|
||||
event_id integer PRIMARY KEY,
|
||||
event_type EventType NOT NULL DEFAULT 'raid' CHECK (event_type = 'raid'),
|
||||
visitor_count INTEGER NOT NULL,
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type)
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE cheer_events (
|
||||
@@ -198,7 +198,7 @@ class DataModel(Registry):
|
||||
amount INTEGER NOT NULL,
|
||||
cheer_type TEXT,
|
||||
message TEXT,
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type)
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE subscriber_events (
|
||||
@@ -207,7 +207,7 @@ class DataModel(Registry):
|
||||
subscribed_length INTEGER NOT NULL,
|
||||
tier INTEGER NOT NULL,
|
||||
message TEXT,
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type)
|
||||
FOREIGN KEY (event_id, event_type) REFERENCES events (event_id, event_type) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE VIEW event_details AS
|
||||
|
||||
Reference in New Issue
Block a user