node: Put new `refs` table in new migration
This commit is contained in:
parent
97af643a86
commit
9a60d4ad7f
|
|
@ -26,6 +26,7 @@ const DB_WRITE_TIMEOUT: time::Duration = time::Duration::from_secs(6);
|
||||||
const MIGRATIONS: &[&str] = &[
|
const MIGRATIONS: &[&str] = &[
|
||||||
include_str!("db/migrations/1.sql"),
|
include_str!("db/migrations/1.sql"),
|
||||||
include_str!("db/migrations/2.sql"),
|
include_str!("db/migrations/2.sql"),
|
||||||
|
include_str!("db/migrations/3.sql"),
|
||||||
];
|
];
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -96,24 +96,3 @@ create table if not exists "repo-sync-status" (
|
||||||
unique ("repo", "node")
|
unique ("repo", "node")
|
||||||
--
|
--
|
||||||
) strict;
|
) 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;
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue