blob: a4dd94199fe134e46bb35c1fd662efa25cad4393 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
-- Deploy guix-build-coordinator:create_systems to sqlite
PRAGMA foreign_keys = OFF;
BEGIN;
CREATE TABLE systems (
id INTEGER PRIMARY KEY,
system TEXT NOT NULL
);
INSERT INTO systems (system)
SELECT system FROM derivations
UNION
SELECT system FROM build_allocation_agent_requested_systems;
CREATE TABLE derivations_new (
id INTEGER PRIMARY KEY ASC,
name TEXT NOT NULL,
system_id INTEGER NOT NULL REFERENCES systems (id),
fixed_output BOOLEAN
CHECK (fixed_output IN (0,1))
);
INSERT INTO derivations_new
SELECT derivations.id, name, systems.id, fixed_output
FROM derivations
INNER JOIN systems ON derivations.system = systems.system;
DROP TABLE derivations;
ALTER TABLE derivations_new RENAME TO derivations;
CREATE UNIQUE INDEX derivations_name_idx ON derivations (name);
CREATE TABLE build_allocation_agent_requested_systems_new (
agent_id INTEGER NOT NULL REFERENCES agents (id),
system_id INTEGER NOT NULL,
PRIMARY KEY (agent_id, system_id)
);
INSERT INTO build_allocation_agent_requested_systems_new
SELECT agent_id, systems.id
FROM build_allocation_agent_requested_systems
INNER JOIN systems
ON build_allocation_agent_requested_systems.system = systems.system;
DROP TABLE build_allocation_agent_requested_systems;
ALTER TABLE build_allocation_agent_requested_systems_new
RENAME TO build_allocation_agent_requested_systems;
PRAGMA foreign_key_check;
COMMIT;
PRAGMA foreign_keys = ON;
|