diff --git a/app-compose/build.gradle b/app-compose/build.gradle index eef51fba0..88b903739 100644 --- a/app-compose/build.gradle +++ b/app-compose/build.gradle @@ -281,6 +281,7 @@ sqldelight { databases { register("FrostDb") { packageName.set("com.pitchedapps.frost.db") + schemaOutputDirectory.set(file("src/main/sqldelight/databases")) } } } \ No newline at end of file diff --git a/app-compose/src/main/sqldelight/com/pitchedapps/frost/db/accounts.sq b/app-compose/src/main/sqldelight/com/pitchedapps/frost/db/accounts.sq index aeb59f713..577e1a662 100644 --- a/app-compose/src/main/sqldelight/com/pitchedapps/frost/db/accounts.sq +++ b/app-compose/src/main/sqldelight/com/pitchedapps/frost/db/accounts.sq @@ -1,5 +1,5 @@ CREATE TABLE IF NOT EXISTS account ( - id INTEGER NOT NULL PRIMARY KEY, + id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name TEXT, avatar TEXT, facebook_cookie TEXT, @@ -15,8 +15,10 @@ INSERT INTO account DEFAULT VALUES; insert: INSERT OR REPLACE INTO account (id, name, avatar, facebook_cookie, messenger_cookie) VALUES (?, ?, ?, ?, ?); -delete: -DELETE FROM account WHERE id == ?; +delete { + DELETE FROM account WHERE id == (:id); + DELETE FROM notifications WHERE id == (:id); +} select: SELECT * diff --git a/app-compose/src/main/sqldelight/com/pitchedapps/frost/db/notifications.sq b/app-compose/src/main/sqldelight/com/pitchedapps/frost/db/notifications.sq new file mode 100644 index 000000000..a7f939540 --- /dev/null +++ b/app-compose/src/main/sqldelight/com/pitchedapps/frost/db/notifications.sq @@ -0,0 +1,21 @@ +CREATE TABLE IF NOT EXISTS notifications ( + id INTEGER NOT NULL PRIMARY KEY, + facebook_notifications INTEGER, + facebook_messages INTEGER, + facebook_friends INTEGER, + messenger_notifications INTEGER +); + +insertNew: +INSERT OR IGNORE INTO notifications (id) VALUES (?); + +insert: +INSERT OR REPLACE INTO notifications (id,facebook_notifications, facebook_messages, facebook_friends, messenger_notifications) VALUES (?,?,?,?,?); + +select: +SELECT * +FROM notifications WHERE id == ?; + +selectAll: +SELECT * +FROM notifications; \ No newline at end of file