@fungi.computer/computer 0.12.0 → 0.12.1

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.
@@ -38,6 +38,13 @@ export function createFleetInventory(options) {
38
38
  const { sql } = options;
39
39
  const ensure = () => {
40
40
  sql.exec("CREATE TABLE IF NOT EXISTS hub_team_computers (computer_id TEXT PRIMARY KEY, name TEXT NOT NULL UNIQUE, size TEXT NOT NULL CHECK (size IN ('small','default','large')), actor_kind TEXT NOT NULL, actor_id TEXT NOT NULL, active INTEGER NOT NULL DEFAULT 1 CHECK (active IN (0,1)), created_at INTEGER NOT NULL, updated_at INTEGER NOT NULL) STRICT");
41
+ // A store created before Computer sizes keeps its old table: give the
42
+ // Computers it already holds the default size.
43
+ const columns = z
44
+ .array(z.looseObject({ name: z.string() }))
45
+ .parse(sql.exec("PRAGMA table_info(hub_team_computers)").toArray());
46
+ if (!columns.some(({ name }) => name === "size"))
47
+ sql.exec(`ALTER TABLE hub_team_computers ADD COLUMN size TEXT NOT NULL DEFAULT '${defaultComputerSize}' CHECK (size IN ('small','default','large'))`);
41
48
  sql.exec("CREATE TABLE IF NOT EXISTS hub_team_computer_create_receipts (request_id TEXT PRIMARY KEY, actor_kind TEXT NOT NULL, actor_id TEXT NOT NULL, requested_name TEXT, name TEXT NOT NULL, computer_id TEXT NOT NULL REFERENCES hub_team_computers(computer_id)) STRICT");
42
49
  };
43
50
  const decode = (row) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/computer",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Cloudflare Computer host for one durable Fungi Computer",
6
6
  "type": "module",