aboutsummaryrefslogtreecommitdiff
path: root/nix/libstore/schema.sql
blob: c1b4a689afcb7e23332ada8a83416559ccb8d166 (about) (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
create table if not exists ValidPaths (
    id               integer primary key autoincrement not null,
    path             text unique not null,
    hash             text not null,
    registrationTime integer not null,
    deriver          text,
    narSize          integer
);

create table if not exists Refs (
    referrer  integer not null,
    reference integer not null,
    primary key (referrer, reference),
    foreign key (referrer) references ValidPaths(id) on delete cascade,
    foreign key (reference) references ValidPaths(id) on delete restrict
);

create index if not exists IndexReferrer on Refs(referrer);
create index if not exists IndexReference on Refs(reference);

-- Paths can refer to themselves, causing a tuple (N, N) in the Refs
-- table.  This causes a deletion of the corresponding row in
-- ValidPaths to cause a foreign key constraint violation (due to `on
-- delete restrict' on the `reference' column).  Therefore, explicitly
-- get rid of self-references.
create trigger if not exists DeleteSelfRefs before delete on ValidPaths
  begin
    delete from Refs where referrer = old.id and reference = old.id;
  end;

create table if not exists DerivationOutputs (
    drv  integer not null,
    id   text not null, -- symbolic output id, usually "out"
    path text not null,
    primary key (drv, id),
    foreign key (drv) references ValidPaths(id) on delete cascade
);

create index if not exists IndexDerivationOutputs on DerivationOutputs(path);

create table if not exists FailedPaths (
    path text primary key not null,
    time integer not null
);
l'>...Vagrant Cascadian 2018-03-29Merge branch 'master' into core-updatesMarius Bakke 2018-03-29gnu: libusb4java: Adjust for building with libusb 1.0.22....Ricardo Wurmus 2018-03-25gnu: libmtp: Update to 1.1.15....Tobias Geerinckx-Rice 2018-03-25gnu: libusb: Update to 1.0.22....Tobias Geerinckx-Rice 2018-03-14Merge branch 'master' into core-updatesRicardo Wurmus 2018-03-13gnu: libusb4java: Declare a source file-name....Efraim Flashner 2018-03-11build-system/gnu: Add 'bootstrap' phase....Ludovic Courtès 2018-02-11gnu: gmtp: Update to 1.3.11....Kei Kebreau 2018-01-10gnu: libmtp: Update to 1.1.14....Tobias Geerinckx-Rice 2017-12-28gnu: Add python-hidapi....Danny Milosavljevic 2017-11-12gnu: libusb-compat: Use the same home page as libusb....Tobias Geerinckx-Rice 2017-10-03Update e-mail for Theodoros Foradis....Theodoros Foradis 2017-09-04gnu: Put autoconf-related phases immediately after the 'unpack phase....Kei Kebreau 2017-07-20gnu: Add libusb@0.1....Jonathan Brielmaier 2017-05-15gnu: Add java-usb4java....Ricardo Wurmus 2017-05-15gnu: Add libusb4java....Ricardo Wurmus