mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-10-24 09:58:35 -04:00
database fixes
This commit is contained in:
1 parent
bc4685a863
commit
e587480bc4
5 files changed
+105
-60
No files matched your search
Generated
+77
-4
@@ -363,6 +363,12 @@ version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
|
||||
|
||||
[[package]]
|
||||
name = "ascii"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e"
|
||||
|
||||
[[package]]
|
||||
name = "asn1_der"
|
||||
version = "0.7.5"
|
||||
@@ -1185,6 +1191,19 @@ dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "combine"
|
||||
version = "3.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680"
|
||||
dependencies = [
|
||||
"ascii",
|
||||
"byteorder",
|
||||
"either",
|
||||
"memchr",
|
||||
"unreachable",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "combine"
|
||||
version = "4.6.3"
|
||||
@@ -1793,6 +1812,17 @@ dependencies = [
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dmmf"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/Brendonovich/prisma-engines?rev=8b94a80a2d8f12a2916fe28e3218162aa71e8539#8b94a80a2d8f12a2916fe28e3218162aa71e8539"
|
||||
dependencies = [
|
||||
"bigdecimal 0.2.2",
|
||||
"datamodel",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dns-parser"
|
||||
version = "0.8.0"
|
||||
@@ -2699,6 +2729,16 @@ dependencies = [
|
||||
"system-deps 6.0.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "graphql-parser"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/prisma/graphql-parser?rev=6a3f58bd879065588e710cb02b5bd30c1ce182c3#6a3f58bd879065588e710cb02b5bd30c1ce182c3"
|
||||
dependencies = [
|
||||
"combine 3.8.1",
|
||||
"indexmap",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gtk"
|
||||
version = "0.15.4"
|
||||
@@ -3292,7 +3332,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24967112a1e4301ca5342ea339763613a37592b8a6ce6cf2e4494537c7a42faf"
|
||||
dependencies = [
|
||||
"cesu8",
|
||||
"combine",
|
||||
"combine 4.6.3",
|
||||
"jni-sys",
|
||||
"log",
|
||||
"thiserror",
|
||||
@@ -5694,14 +5734,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "prisma-client-rust"
|
||||
version = "0.4.1"
|
||||
source = "git+https://github.com/Brendonovich/prisma-client-rust.git?tag=0.4.1#72326a946fa9fad4872eeeb9fa826f7acd5a0bed"
|
||||
version = "0.4.0"
|
||||
source = "git+https://github.com/Brendonovich/prisma-client-rust.git?tag=0.4.0#4c6c4bf93c8eb5f3a16efca161983a9537e5e53b"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"datamodel",
|
||||
"graphql-parser",
|
||||
"prisma-models",
|
||||
"query-connector",
|
||||
"query-core",
|
||||
"request-handlers",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
@@ -5710,7 +5752,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "prisma-client-rust-cli"
|
||||
version = "0.4.0"
|
||||
source = "git+https://github.com/Brendonovich/prisma-client-rust?tag=0.4.0#4c6c4bf93c8eb5f3a16efca161983a9537e5e53b"
|
||||
source = "git+https://github.com/Brendonovich/prisma-client-rust.git?tag=0.4.0#4c6c4bf93c8eb5f3a16efca161983a9537e5e53b"
|
||||
dependencies = [
|
||||
"convert_case 0.5.0",
|
||||
"directories",
|
||||
@@ -6213,6 +6255,28 @@ dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "request-handlers"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/Brendonovich/prisma-engines?rev=8b94a80a2d8f12a2916fe28e3218162aa71e8539#8b94a80a2d8f12a2916fe28e3218162aa71e8539"
|
||||
dependencies = [
|
||||
"bigdecimal 0.2.2",
|
||||
"connection-string",
|
||||
"datamodel",
|
||||
"dmmf",
|
||||
"futures",
|
||||
"graphql-parser",
|
||||
"indexmap",
|
||||
"itertools",
|
||||
"query-core",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"url",
|
||||
"user-facing-errors",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.11.10"
|
||||
@@ -8110,6 +8174,15 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unreachable"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
|
||||
dependencies = [
|
||||
"void",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unsigned-varint"
|
||||
version = "0.7.1"
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ int-enum = "0.4.0"
|
||||
|
||||
# Project dependencies
|
||||
ts-rs = "6.1"
|
||||
prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust.git", tag = "0.4.1" }
|
||||
prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust.git", tag = "0.4.0" }
|
||||
walkdir = "^2.3.2"
|
||||
libp2p = { version = "0.43.0", optional = true }
|
||||
lazy_static = "1.4.0"
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "_migrations" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"name" TEXT NOT NULL,
|
||||
"checksum" TEXT NOT NULL,
|
||||
"steps_applied" INTEGER NOT NULL DEFAULT 0,
|
||||
"applied_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "_migrations_checksum_key" ON "_migrations"("checksum");
|
||||
@@ -1,12 +1,3 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "_migrations" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"name" TEXT NOT NULL,
|
||||
"checksum" TEXT NOT NULL,
|
||||
"steps_applied" INTEGER NOT NULL DEFAULT 0,
|
||||
"applied_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "sync_events" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -18,7 +9,6 @@ CREATE TABLE "sync_events" (
|
||||
"value" TEXT NOT NULL,
|
||||
CONSTRAINT "sync_events_node_id_fkey" FOREIGN KEY ("node_id") REFERENCES "nodes" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "libraries" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -28,7 +18,6 @@ CREATE TABLE "libraries" (
|
||||
"date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"timezone" TEXT
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "library_statistics" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -42,7 +31,6 @@ CREATE TABLE "library_statistics" (
|
||||
"total_bytes_free" TEXT NOT NULL DEFAULT '0',
|
||||
"preview_media_bytes" TEXT NOT NULL DEFAULT '0'
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "nodes" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -54,7 +42,6 @@ CREATE TABLE "nodes" (
|
||||
"timezone" TEXT,
|
||||
"date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "volumes" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -68,7 +55,6 @@ CREATE TABLE "volumes" (
|
||||
"is_system" BOOLEAN NOT NULL DEFAULT false,
|
||||
"date_modified" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "locations" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -84,7 +70,6 @@ CREATE TABLE "locations" (
|
||||
"is_online" BOOLEAN NOT NULL DEFAULT true,
|
||||
"date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "files" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -104,9 +89,9 @@ CREATE TABLE "files" (
|
||||
"date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"date_modified" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"date_indexed" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT "files_key_id_fkey" FOREIGN KEY ("key_id") REFERENCES "keys" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
CONSTRAINT "files_key_id_fkey" FOREIGN KEY ("key_id") REFERENCES "keys" ("id") ON DELETE
|
||||
SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "file_paths" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -123,16 +108,16 @@ CREATE TABLE "file_paths" (
|
||||
"date_indexed" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT "file_paths_location_id_fkey" FOREIGN KEY ("location_id") REFERENCES "locations" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT "file_paths_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "files" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT "file_paths_parent_id_fkey" FOREIGN KEY ("parent_id") REFERENCES "file_paths" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT "file_paths_key_id_fkey" FOREIGN KEY ("key_id") REFERENCES "keys" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
CONSTRAINT "file_paths_parent_id_fkey" FOREIGN KEY ("parent_id") REFERENCES "file_paths" ("id") ON DELETE
|
||||
SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT "file_paths_key_id_fkey" FOREIGN KEY ("key_id") REFERENCES "keys" ("id") ON DELETE
|
||||
SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "file_conflicts" (
|
||||
"original_file_id" INTEGER NOT NULL,
|
||||
"detactched_file_id" INTEGER NOT NULL
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "keys" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -141,7 +126,6 @@ CREATE TABLE "keys" (
|
||||
"date_created" DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
"algorithm" INTEGER DEFAULT 0
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "media_data" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -158,7 +142,6 @@ CREATE TABLE "media_data" (
|
||||
"streams" INTEGER,
|
||||
CONSTRAINT "media_data_id_fkey" FOREIGN KEY ("id") REFERENCES "files" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "tags" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -169,18 +152,15 @@ CREATE TABLE "tags" (
|
||||
"date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"date_modified" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "tags_on_files" (
|
||||
"date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"tag_id" INTEGER NOT NULL,
|
||||
"file_id" INTEGER NOT NULL,
|
||||
|
||||
PRIMARY KEY ("tag_id", "file_id"),
|
||||
CONSTRAINT "tags_on_files_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "files" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT "tags_on_files_tag_id_fkey" FOREIGN KEY ("tag_id") REFERENCES "tags" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "labels" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -189,18 +169,15 @@ CREATE TABLE "labels" (
|
||||
"date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"date_modified" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "label_on_files" (
|
||||
"date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"label_id" INTEGER NOT NULL,
|
||||
"file_id" INTEGER NOT NULL,
|
||||
|
||||
PRIMARY KEY ("label_id", "file_id"),
|
||||
CONSTRAINT "label_on_files_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "files" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT "label_on_files_label_id_fkey" FOREIGN KEY ("label_id") REFERENCES "labels" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "jobs" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
@@ -215,7 +192,6 @@ CREATE TABLE "jobs" (
|
||||
"seconds_elapsed" INTEGER NOT NULL DEFAULT 0,
|
||||
CONSTRAINT "jobs_node_id_fkey" FOREIGN KEY ("node_id") REFERENCES "nodes" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "albums" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -225,18 +201,15 @@ CREATE TABLE "albums" (
|
||||
"date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"date_modified" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "files_in_albums" (
|
||||
"date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"album_id" INTEGER NOT NULL,
|
||||
"file_id" INTEGER NOT NULL,
|
||||
|
||||
PRIMARY KEY ("album_id", "file_id"),
|
||||
CONSTRAINT "files_in_albums_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "files" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT "files_in_albums_album_id_fkey" FOREIGN KEY ("album_id") REFERENCES "albums" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "comments" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -245,53 +218,41 @@ CREATE TABLE "comments" (
|
||||
"date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"date_modified" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"file_id" INTEGER,
|
||||
CONSTRAINT "comments_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "files" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
CONSTRAINT "comments_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "files" ("id") ON DELETE
|
||||
SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "_migrations_checksum_key" ON "_migrations"("checksum");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "libraries_pub_id_key" ON "libraries"("pub_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "library_statistics_library_id_key" ON "library_statistics"("library_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "nodes_pub_id_key" ON "nodes"("pub_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "volumes_node_id_mount_point_name_key" ON "volumes"("node_id", "mount_point", "name");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "locations_pub_id_key" ON "locations"("pub_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "files_cas_id_key" ON "files"("cas_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "files_integrity_checksum_key" ON "files"("integrity_checksum");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "file_paths_location_id_materialized_path_name_extension_key" ON "file_paths"("location_id", "materialized_path", "name", "extension");
|
||||
|
||||
CREATE UNIQUE INDEX "file_paths_location_id_materialized_path_name_extension_key" ON "file_paths"(
|
||||
"location_id",
|
||||
"materialized_path",
|
||||
"name",
|
||||
"extension"
|
||||
);
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "file_conflicts_original_file_id_key" ON "file_conflicts"("original_file_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "file_conflicts_detactched_file_id_key" ON "file_conflicts"("detactched_file_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "keys_checksum_key" ON "keys"("checksum");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "tags_pub_id_key" ON "tags"("pub_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "labels_pub_id_key" ON "labels"("pub_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "albums_pub_id_key" ON "albums"("pub_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "comments_pub_id_key" ON "comments"("pub_id");
|
||||
CREATE UNIQUE INDEX "comments_pub_id_key" ON "comments"("pub_id");
|
||||
@@ -7,7 +7,8 @@ use ring::digest::{Context, Digest, SHA256};
|
||||
use std::ffi::OsStr;
|
||||
use std::io::{BufReader, Read};
|
||||
|
||||
const INIT_MIGRATION: &str = include_str!("../../prisma/migrations/migration_table/migration.sql");
|
||||
const INIT_MIGRATION: &str =
|
||||
include_str!("../../prisma/migrations/0_migration_table/migration.sql");
|
||||
static MIGRATIONS_DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/prisma/migrations");
|
||||
|
||||
pub fn sha256_digest<R: Read>(mut reader: R) -> Result<Digest> {
|
||||
|
||||
Reference in new issue
Block a user