emissary/migrations/sqlite/0000003_tenant.down.sql
William Petit ca4211daef
All checks were successful
arcad/emissary/pipeline/head This commit looks good
arcad/emissary/pipeline/pr-master This commit looks good
feat: resources segregation by tenant
2024-02-26 18:20:40 +01:00

42 lines
879 B
SQL

ALTER TABLE agents RENAME TO _agents;
CREATE TABLE agents
(
id INTEGER PRIMARY KEY,
thumbprint TEXT UNIQUE,
keyset TEXT,
metadata TEXT,
status INTEGER NOT NULL,
created_at datetime NOT NULL,
updated_at datetime NOT NULL,
label TEXT DEFAULT "",
contacted_at datetime
);
INSERT INTO agents SELECT id, thumbprint, keyset, metadata, status, created_at, updated_at, label, contacted_at FROM _agents;
DROP TABLE _agents;
---
ALTER TABLE specs RENAME TO _specs;
CREATE TABLE specs
(
id INTEGER PRIMARY KEY,
thumbprint TEXT UNIQUE,
keyset TEXT,
metadata TEXT,
status INTEGER NOT NULL,
created_at datetime NOT NULL,
updated_at datetime NOT NULL,
label TEXT DEFAULT ""
);
INSERT INTO specs SELECT id, agent_id, name, revision, data, created_at, updated_at FROM _specs;
DROP TABLE _specs;
---
DROP TABLE tenants;