forest
dad6547825
Conflicts: capsulflask/console.py capsulflask/db.py capsulflask/shared.py capsulflask/virt_model.py
33 lines
998 B
SQL
33 lines
998 B
SQL
|
|
|
|
CREATE TABLE hosts (
|
|
id TEXT PRIMARY KEY NOT NULL,
|
|
last_health_check TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
https_url TEXT NOT NULL,
|
|
token TEXT NOT NULL
|
|
);
|
|
|
|
INSERT INTO hosts (id, https_url, token) VALUES ('baikal', 'http://localhost:5000', 'changeme');
|
|
|
|
ALTER TABLE vms
|
|
ADD COLUMN host TEXT REFERENCES hosts(id) ON DELETE RESTRICT DEFAULT 'baikal';
|
|
|
|
CREATE TABLE operations (
|
|
id SERIAL PRIMARY KEY ,
|
|
email TEXT REFERENCES accounts(email) ON DELETE RESTRICT,
|
|
created TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
payload TEXT NOT NULL
|
|
);
|
|
|
|
CREATE TABLE host_operation (
|
|
host TEXT NOT NULL REFERENCES hosts(id) ON DELETE RESTRICT,
|
|
operation INTEGER NOT NULL REFERENCES operations(id) ON DELETE RESTRICT,
|
|
assignment_status TEXT NULL,
|
|
assigned TIMESTAMP NULL,
|
|
completed TIMESTAMP NULL,
|
|
results TEXT NULL,
|
|
PRIMARY KEY (host, operation)
|
|
);
|
|
|
|
UPDATE schemaversion SET version = 13;
|