From 9a60d4ad7fc6c7219e96a42b4f80007be6945c76 Mon Sep 17 00:00:00 2001 From: cloudhead Date: Mon, 1 Apr 2024 15:00:13 +0200 Subject: [PATCH] node: Put new `refs` table in new migration --- radicle/src/node/db.rs | 1 + radicle/src/node/db/migrations/3.sql | 19 +++++++++++++++++++ radicle/src/node/db/schema.sql | 21 --------------------- 3 files changed, 20 insertions(+), 21 deletions(-) create mode 100644 radicle/src/node/db/migrations/3.sql diff --git a/radicle/src/node/db.rs b/radicle/src/node/db.rs index d7045545..a99962ff 100644 --- a/radicle/src/node/db.rs +++ b/radicle/src/node/db.rs @@ -26,6 +26,7 @@ const DB_WRITE_TIMEOUT: time::Duration = time::Duration::from_secs(6); const MIGRATIONS: &[&str] = &[ include_str!("db/migrations/1.sql"), include_str!("db/migrations/2.sql"), + include_str!("db/migrations/3.sql"), ]; #[derive(Error, Debug)] diff --git a/radicle/src/node/db/migrations/3.sql b/radicle/src/node/db/migrations/3.sql new file mode 100644 index 00000000..f0d30426 --- /dev/null +++ b/radicle/src/node/db/migrations/3.sql @@ -0,0 +1,19 @@ +-- Git refs cache. +create table if not exists "refs" ( + -- Repository ID. + "repo" text not null, + -- Ref namespace (NID). + -- + -- Nb. We don't use a foreign key constraint because we can't guarantee + -- that we'll have received a node announcement from this node. + "namespace" text not null, + -- Ref name (qualified). + "ref" text not null, + -- Ref OID. + "oid" text not null, + -- When this entry was created or updated. + "timestamp" integer not null, + -- + unique ("repo", "namespace", "ref") + -- +) strict; diff --git a/radicle/src/node/db/schema.sql b/radicle/src/node/db/schema.sql index fe4c62ba..d1a62f1f 100644 --- a/radicle/src/node/db/schema.sql +++ b/radicle/src/node/db/schema.sql @@ -96,24 +96,3 @@ create table if not exists "repo-sync-status" ( unique ("repo", "node") -- ) strict; - --- Git refs cache. -create table if not exists "refs" ( - -- Repository ID. - "repo" text not null, - -- Ref namespace (NID). - -- - -- Nb. We don't use a foreign key constraint because we can't guarantee - -- that we'll have received a node announcement from this node. - "namespace" text not null, - -- Ref name (qualified). - "ref" text not null, - -- Ref OID. - "oid" text not null, - -- When this entry was created or updated. - "timestamp" integer not null, - -- - unique ("repo", "namespace", "ref") - -- -) strict; -