emissary/migrations/sqlite/0000005_spec_version.down.sql

35 lines
665 B
MySQL
Raw Normal View History

ALTER TABLE specs
RENAME TO _specs;
CREATE TABLE
specs (
id INTEGER PRIMARY KEY,
agent_id INTEGER,
tenant_id TEXT,
name TEXT NOT NULL,
revision INTEGER DEFAULT 0,
data TEXT,
created_at datetime NOT NULL,
updated_at datetime NOT NULL,
FOREIGN KEY (tenant_id) REFERENCES tenants (id),
FOREIGN KEY (agent_id) REFERENCES agents (id) ON DELETE CASCADE,
UNIQUE (agent_id, name) ON CONFLICT REPLACE
);
INSERT INTO
specs
SELECT
id,
agent_id,
tenant_id,
name,
revision,
data,
created_at,
updated_at
FROM
_specs;
DROP TABLE _specs;
---