mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 11:42:25 +00:00
make sure a birthday calendar will be created for each addressbook
This commit is contained in:
@@ -12,4 +12,15 @@ CREATE TABLE birthday_calendars (
|
|||||||
CONSTRAINT fk_birthdays_addressbooks FOREIGN KEY (principal, id)
|
CONSTRAINT fk_birthdays_addressbooks FOREIGN KEY (principal, id)
|
||||||
REFERENCES addressbooks (principal, id) ON DELETE CASCADE
|
REFERENCES addressbooks (principal, id) ON DELETE CASCADE
|
||||||
-- birthday calendar stores no meaningful data so we can cascade
|
-- birthday calendar stores no meaningful data so we can cascade
|
||||||
)
|
);
|
||||||
|
|
||||||
|
INSERT INTO birthday_calendars
|
||||||
|
(principal, id, displayname, deleted_at, push_topic)
|
||||||
|
SELECT
|
||||||
|
principal,
|
||||||
|
id,
|
||||||
|
displayname || ' birthdays' AS displayname,
|
||||||
|
deleted_at,
|
||||||
|
push_topic || substr(printf('%d', random()), -4) AS push_topic
|
||||||
|
-- jank suffix to ensure that new push_topic is different :D
|
||||||
|
FROM addressbooks;
|
||||||
|
|||||||
Reference in New Issue
Block a user