unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 8123190d2981c230c74fb953326d62e7d184c243 1421 bytes (raw)
name: src/sql/upgrade-3.sql 	 # note: path name is non-authoritative(*)

 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
 
BEGIN TRANSACTION;

ALTER TABLE Evaluations RENAME TO tmp_Evaluations;

CREATE TABLE Evaluations (
  id            INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  specification TEXT NOT NULL,
  in_progress   INTEGER NOT NULL,
  FOREIGN KEY (specification) REFERENCES Specifications (name)
);

CREATE TABLE Checkouts (
  specification TEXT NOT NULL,
  revision      INTEGER NOT NULL,
  evaluation    TEXT NOT NULL,
  input         TEXT NOT NULL,
  directory     TEXT NOT NULL,
  PRIMARY KEY (specification, revision),
  FOREIGN KEY (evaluation) REFERENCES Evaluations (id),
  FOREIGN KEY (specification) REFERENCES Specifications (name),
  FOREIGN KEY (input) REFERENCES Inputs (name)
);

INSERT INTO Evaluations (id, specification, in_progress)
SELECT id, specification, false
FROM tmp_Evaluations;

-- Copied from https://www.samuelbosch.com/2018/02/split-into-rows-sqlite.html.
INSERT OR IGNORE INTO Checkouts (specification, revision, evaluation, input, directory)
WITH RECURSIVE split(id, specification, revision, rest) AS (
  SELECT id, specification, '', commits || ' ' FROM tmp_Evaluations
   UNION ALL
  SELECT id, 
         specification,
         substr(rest, 0, instr(rest, ' ')),
         substr(rest, instr(rest, ' ') + 1)
    FROM split
   WHERE rest <> '')
SELECT specification, revision, id, 'unknown', 'unknown'
  FROM split 
 WHERE revision <> '';

DROP TABLE tmp_Evaluations;
DROP TABLE Stamps;

COMMIT;

debug log:

solving 8123190 ...
found 8123190 in https://yhetil.org/guix-patches/20180811222636.5198-1-clement@lassieur.org/

applying [1/1] https://yhetil.org/guix-patches/20180811222636.5198-1-clement@lassieur.org/
diff --git a/src/sql/upgrade-3.sql b/src/sql/upgrade-3.sql
new file mode 100644
index 0000000..8123190

1:39: trailing whitespace.
  SELECT id, 
1:46: trailing whitespace.
  FROM split 
Checking patch src/sql/upgrade-3.sql...
Applied patch src/sql/upgrade-3.sql cleanly.
warning: 2 lines add whitespace errors.

index at:
100644 8123190d2981c230c74fb953326d62e7d184c243	src/sql/upgrade-3.sql

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).