Skip to content

Commit c93513c

Browse files
committed
Add ps_kv table.
1 parent 80177fe commit c93513c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

crates/core/src/view_admin.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ CREATE TABLE IF NOT EXISTS ps_migration(id INTEGER PRIMARY KEY, down_migrations
131131
return Err(SQLiteError::from(ResultCode::ABORT));
132132
}
133133

134-
const CODE_VERSION: i32 = 2;
134+
const CODE_VERSION: i32 = 3;
135135

136136
let mut current_version = current_version_stmt.column_int(0)?;
137137

@@ -238,6 +238,16 @@ INSERT INTO ps_migration(id, down_migrations) VALUES(2, json_array(json_object('
238238
").into_db_result(local_db)?;
239239
}
240240

241+
if current_version < 3 {
242+
// language=SQLite
243+
local_db.exec_safe("\
244+
CREATE TABLE ps_kv(key TEXT PRIMARY KEY NOT NULL, value BLOB);
245+
INSERT INTO ps_kv(key, value) values('client_id', uuid());
246+
247+
INSERT INTO ps_migration(id, down_migrations) VALUES(3, json_array(json_object('sql', 'DELETE FROM ps_migration WHERE id >= 3'), json_object('sql', 'DROP TABLE ps_kv')));
248+
").into_db_result(local_db)?;
249+
}
250+
241251
Ok(String::from(""))
242252
}
243253

0 commit comments

Comments
 (0)