@starkeep/storage-sqlite 0.6.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -27,7 +27,8 @@ declare const compiler: Kysely<DB>;
27
27
  *
28
28
  * No migration system: this is a fresh-start schema. The user removes
29
29
  * ~/.starkeep/data.db (or the local-data-server's STARKEEP_DIR is fresh)
30
- * before this code runs.
30
+ * before this code runs. One temporary guard is the exception: it adds
31
+ * `shared_app_registry.source_dir` to a registry created before the column.
31
32
  */
32
33
  /**
33
34
  * Connection settings the query grammar's portability depends on.
package/dist/index.d.ts CHANGED
@@ -27,7 +27,8 @@ declare const compiler: Kysely<DB>;
27
27
  *
28
28
  * No migration system: this is a fresh-start schema. The user removes
29
29
  * ~/.starkeep/data.db (or the local-data-server's STARKEEP_DIR is fresh)
30
- * before this code runs.
30
+ * before this code runs. One temporary guard is the exception: it adds
31
+ * `shared_app_registry.source_dir` to a registry created before the column.
31
32
  */
32
33
  /**
33
34
  * Connection settings the query grammar's portability depends on.
package/dist/index.js CHANGED
@@ -225,8 +225,14 @@ function applyLocalSchemaDdl(db) {
225
225
  compiler.schema.createTable("shared_app_label_keys").ifNotExists().addColumn("app_id", "text", (c) => c.notNull()).addColumn("key", "text", (c) => c.notNull()).addColumn("description", "text").addColumn("created_at", "text", (c) => c.notNull().defaultTo(sql`(datetime('now'))`)).addPrimaryKeyConstraint("pk_shared_app_label_keys", ["app_id", "key"]).compile().sql
226
226
  );
227
227
  db.exec(
228
- compiler.schema.createTable("shared_app_registry").ifNotExists().addColumn("app_id", "text", (c) => c.primaryKey()).addColumn("name", "text", (c) => c.notNull()).addColumn("version", "text", (c) => c.notNull()).addColumn("tier", "text", (c) => c.notNull().defaultTo("app")).addColumn("manifest", "text", (c) => c.notNull()).addColumn("status", "text", (c) => c.notNull().defaultTo("installing")).addColumn("hmac_secret", "text", (c) => c.notNull()).addColumn("installed_at", "text", (c) => c.notNull().defaultTo(sql`(datetime('now'))`)).addColumn("updated_at", "text", (c) => c.notNull().defaultTo(sql`(datetime('now'))`)).compile().sql
228
+ compiler.schema.createTable("shared_app_registry").ifNotExists().addColumn("app_id", "text", (c) => c.primaryKey()).addColumn("name", "text", (c) => c.notNull()).addColumn("version", "text", (c) => c.notNull()).addColumn("tier", "text", (c) => c.notNull().defaultTo("app")).addColumn("manifest", "text", (c) => c.notNull()).addColumn("status", "text", (c) => c.notNull().defaultTo("installing")).addColumn("hmac_secret", "text", (c) => c.notNull()).addColumn("installed_at", "text", (c) => c.notNull().defaultTo(sql`(datetime('now'))`)).addColumn("updated_at", "text", (c) => c.notNull().defaultTo(sql`(datetime('now'))`)).addColumn("source_dir", "text").compile().sql
229
229
  );
230
+ const registryColumns = db.prepare("SELECT name FROM pragma_table_info('shared_app_registry')").all();
231
+ if (!registryColumns.some((c) => c.name === "source_dir")) {
232
+ db.exec(
233
+ compiler.schema.alterTable("shared_app_registry").addColumn("source_dir", "text").compile().sql
234
+ );
235
+ }
230
236
  db.exec(
231
237
  compiler.schema.createTable("shared_app_install_steps").ifNotExists().addColumn("app_id", "text", (c) => c.notNull()).addColumn(
232
238
  "operation",