Migrate local persistence from Room to SQLDelight with multiplatform support (Android+iOS); replace NoteEntity/DAO/Repository with generated SQLDelight schema, add DatabaseFactory for drivers, integrate Flow support for Compose UI updates
This commit is contained in:
16
shared/src/commonMain/sqldelight/app/klottr/db/Notes.sq
Normal file
16
shared/src/commonMain/sqldelight/app/klottr/db/Notes.sq
Normal file
@@ -0,0 +1,16 @@
|
||||
CREATE TABLE notes (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
lat REAL NOT NULL,
|
||||
lon REAL NOT NULL,
|
||||
text TEXT NOT NULL,
|
||||
createdAt INTEGER NOT NULL DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX notes_lat_lon_index ON notes(lat, lon);
|
||||
|
||||
all:
|
||||
SELECT * FROM notes ORDER BY id DESC;
|
||||
|
||||
upsert:
|
||||
INSERT OR REPLACE INTO notes(id, lat, lon, text, createdAt)
|
||||
VALUES (?, ?, ?, ?, ?);
|
||||
Reference in New Issue
Block a user