diff options
Diffstat (limited to 'server/migrations/2_rwgps_up.sql')
| -rw-r--r-- | server/migrations/2_rwgps_up.sql | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/server/migrations/2_rwgps_up.sql b/server/migrations/2_rwgps_up.sql new file mode 100644 index 0000000..569479b --- /dev/null +++ b/server/migrations/2_rwgps_up.sql | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | CREATE TABLE rwgps_notification ( | ||
| 2 | id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
| 3 | rwgps_timestamp TEXT NOT NULL, | ||
| 4 | user_id INTEGER NOT NULL, | ||
| 5 | item_type TEXT, -- NULL if unknown | ||
| 6 | item_id INTEGER, | ||
| 7 | item_user_id INTEGER, | ||
| 8 | item_url TEXT, | ||
| 9 | action_ TEXT, -- NULL if unknown | ||
| 10 | CHECK (rwgps_timestamp IS strftime('%FT%TZ', rwgps_timestamp)), | ||
| 11 | CHECK (item_type IN ('trip', 'route', 'event', 'event_participant', 'club_member', 'authorization')), | ||
| 12 | CHECK (action_ IN ('created', 'updated', 'deleted', 'added', 'removed')) | ||
| 13 | ) STRICT; | ||
| 14 | |||
| 15 | CREATE TABLE rwgps_notification_target_collection ( | ||
| 16 | notification_id INTEGER PRIMARY KEY, | ||
| 17 | id INTEGER NOT NULL, | ||
| 18 | type_ TEXT, -- NULL if unknown | ||
| 19 | url TEXT, | ||
| 20 | CHECK (type_ IN ('pinned')), | ||
| 21 | FOREIGN KEY (notification_id) REFERENCES rwgps_notification (id) | ||
| 22 | ) STRICT; | ||