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
);
e050612cdefe470b100c'>Merge branch 'master' into core-updatesLeo Famulari 2017-07-20gnu: heimdal: Fix CVE-2017-{6594,11103}....Alex Vong 2017-07-14gnu: mit-krb5: Add ‘cpe-name’....Tobias Geerinckx-Rice 2017-06-30gnu: shishi: Build with latest libgcrypt....Leo Famulari 2017-05-24gnu: mit-krb5: Enable parallel build and tests....Ricardo Wurmus 2017-05-24gnu: mit-krb5: Update to 1.15.1....Ricardo Wurmus 2017-03-30Merge branch 'master' into core-updates...Marius Bakke 2017-03-30gnu: Use HTTPS for almost all gnu.org HOME-PAGEs....Tobias Geerinckx-Rice 2017-01-23Merge branch 'master' into core-updatesLudovic Courtès 2017-01-19gnu: Add Heimdal....Ludovic Courtès 2017-01-19gnu: Move Kerberos implemetations to (gnu packages kerberos)....Ludovic Courtès