21 lines
520 B
MySQL
21 lines
520 B
MySQL
|
---
|
||
|
|
||
|
CREATE TABLE agents (
|
||
|
id INTEGER PRIMARY KEY,
|
||
|
remote_id TEXT NOT NULL UNIQUE,
|
||
|
status INTEGER NOT NULL,
|
||
|
created_at datetime NOT NULL,
|
||
|
updated_at datetime NOT NULL
|
||
|
);
|
||
|
|
||
|
CREATE TABLE specs (
|
||
|
id INTEGER PRIMARY KEY,
|
||
|
agent_id INTEGER,
|
||
|
name TEXT NOT NULL,
|
||
|
revision INTEGER DEFAULT 0,
|
||
|
data TEXT,
|
||
|
created_at datetime NOT NULL,
|
||
|
updated_at datetime NOT NULL,
|
||
|
FOREIGN KEY (agent_id) REFERENCES agents (id) ON DELETE CASCADE,
|
||
|
UNIQUE(agent_id, name) ON CONFLICT REPLACE
|
||
|
);
|