Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Put new `refs` table in new migration
cloudhead committed 2 years ago
commit 9a60d4ad7fc6c7219e96a42b4f80007be6945c76
parent 97af643a86c7abc4a4ed071f811a17a494eff48f
3 files changed +20 -21
modified 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)]
added 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;
modified 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;
-