Overview
Comment:Fix migration from older version with not unique URLs
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: 8f9740d22222a1cae9541a5904ae7b292d5592ca8cd8c331d18689176277fd93
User & Date: bohwaz on 2021-06-23 00:48:28
Other Links: manifest | tags
Context
2021-06-28
13:31
Update doc links check-in: 1df606f73f user: bohwaz tags: trunk
2021-06-23
00:48
Fix migration from older version with not unique URLs check-in: 8f9740d222 user: bohwaz tags: trunk, stable
2021-06-20
19:16
Fix 1.1.8 bug with web and SQLite storage, where pages disappeared check-in: a2880f0555 user: bohwaz tags: trunk, stable, 1.1.9
Changes

Modified src/include/data/1.1.7_migration.sql from [40a52d8865] to [1dab4145d3].

1
2
3
4


5
6














7
8
9







ALTER TABLE services_reminders_sent RENAME TO srs_old;

-- Missing acc_years_delete trigger, again, because of missing symlink in previous release
-- Also add new column in services_reminders_sent



.read schema.sql















INSERT INTO services_reminders_sent SELECT id, id_user, id_service, id_reminder, date, date FROM srs_old;
DROP TABLE srs_old;









<
|
>
>
|
<
>
>
>
>
>
>
>
>
>
>
>
>
>
>



>
>
>
>
>
>
>
1
2

3
4
5
6

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
ALTER TABLE services_reminders_sent RENAME TO srs_old;


-- Add new column in services_reminders_sent
CREATE TABLE IF NOT EXISTS services_reminders_sent
-- Enregistrement des rappels envoyés à qui et quand
(

    id INTEGER NOT NULL PRIMARY KEY,

    id_user INTEGER NOT NULL REFERENCES membres (id) ON DELETE CASCADE,
    id_service INTEGER NOT NULL REFERENCES services (id) ON DELETE CASCADE,
    id_reminder INTEGER NOT NULL REFERENCES services_reminders (id) ON DELETE CASCADE,

    sent_date TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(sent_date) IS NOT NULL AND date(sent_date) = sent_date),
    due_date TEXT NOT NULL CHECK (date(due_date) IS NOT NULL AND date(due_date) = due_date)
);

CREATE UNIQUE INDEX IF NOT EXISTS srs_index ON services_reminders_sent (id_user, id_service, id_reminder, due_date);

CREATE INDEX IF NOT EXISTS srs_reminder ON services_reminders_sent (id_reminder);
CREATE INDEX IF NOT EXISTS srs_user ON services_reminders_sent (id_user);

INSERT INTO services_reminders_sent SELECT id, id_user, id_service, id_reminder, date, date FROM srs_old;
DROP TABLE srs_old;

-- Missing acc_years_delete trigger, again, because of missing symlink in previous release
-- Make sure id_account is reset when a year is deleted
CREATE TRIGGER IF NOT EXISTS acc_years_delete BEFORE DELETE ON acc_years BEGIN
    UPDATE services_fees SET id_account = NULL, id_year = NULL WHERE id_year = OLD.id;
END;