node: Put new `refs` table in new migration

This commit is contained in:
cloudhead 2024-04-01 15:00:13 +02:00
parent 97af643a86
commit 9a60d4ad7f
No known key found for this signature in database
3 changed files with 20 additions and 21 deletions

View File

@ -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)]

View File

@ -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;

View File

@ -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;