Merge pull request #6324 from trofi/selfref-ca-index

ca: add sqlite index on `RealisationsRefs(realisationReference)`
This commit is contained in:
Théophane Hufschmitt 2022-03-26 18:03:49 +01:00 committed by Théophane Hufschmitt
commit 0155a3b3da
6 changed files with 8 additions and 4 deletions

View file

@ -32,6 +32,8 @@ create table if not exists RealisationsRefs (
foreign key (referrer) references Realisations(id) on delete cascade, foreign key (referrer) references Realisations(id) on delete cascade,
foreign key (realisationReference) references Realisations(id) on delete restrict foreign key (realisationReference) references Realisations(id) on delete restrict
); );
-- used by deletion trigger
create index if not exists IndexRealisationsRefsRealisationReference on RealisationsRefs(realisationReference);
-- used by QueryRealisationReferences -- used by QueryRealisationReferences
create index if not exists IndexRealisationsRefs on RealisationsRefs(referrer); create index if not exists IndexRealisationsRefs on RealisationsRefs(referrer);

View file

@ -152,6 +152,8 @@ void migrateCASchema(SQLite& db, Path schemaPath, AutoCloseFD& lockFd)
select id from Realisations where outputPath = old.id select id from Realisations where outputPath = old.id
); );
end; end;
-- used by deletion trigger
create index if not exists IndexRealisationsRefsRealisationReference on RealisationsRefs(realisationReference);
)"); )");
txn.commit(); txn.commit();
} }

View file

@ -2,7 +2,7 @@ source common.sh
file=build-hook-ca-floating.nix file=build-hook-ca-floating.nix
enableFeatures "ca-derivations ca-references" enableFeatures "ca-derivations"
CONTENT_ADDRESSED=true CONTENT_ADDRESSED=true

View file

@ -1,5 +1,5 @@
source ../common.sh source ../common.sh
enableFeatures "ca-derivations ca-references" enableFeatures "ca-derivations"
restartDaemon restartDaemon

View file

@ -4,7 +4,7 @@ source common.sh
requireDaemonNewerThan "2.4pre20210626" requireDaemonNewerThan "2.4pre20210626"
sed -i 's/experimental-features .*/& ca-derivations ca-references nix-command flakes/' "$NIX_CONF_DIR"/nix.conf enableFeatures "ca-derivations nix-command flakes"
export NIX_TESTS_CA_BY_DEFAULT=1 export NIX_TESTS_CA_BY_DEFAULT=1
cd .. cd ..

View file

@ -3,7 +3,7 @@ source common.sh
clearStore clearStore
clearProfiles clearProfiles
enableFeatures "ca-derivations ca-references" enableFeatures "ca-derivations"
restartDaemon restartDaemon
# Make a flake. # Make a flake.