This commit is contained in:
1 parent
d74db2096c
commit
8c763786c1
25 files changed
+3614
-407
No files matched your search
@@ -0,0 +1,6 @@
|
||||
version = 1
|
||||
|
||||
[[migrations]]
|
||||
id = 3569579561409902287
|
||||
name = "0000_init.sql"
|
||||
snapshot_name = "0000_snapshot.toml"
|
||||
@@ -0,0 +1,28 @@
|
||||
CREATE TYPE "job_status" AS ENUM ('pending', 'processing');
|
||||
CREATE TABLE "jobs" (
|
||||
"id" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||
"event_id" BIGINT NOT NULL,
|
||||
"repo" TEXT NOT NULL,
|
||||
"pr" BIGINT NOT NULL,
|
||||
"payload" JSONB NOT NULL,
|
||||
"status" "job_status" NOT NULL,
|
||||
"created_at" TIMESTAMPTZ(6) NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
CREATE UNIQUE INDEX "index_jobs_by_event_id" ON "jobs" ("event_id");
|
||||
CREATE INDEX "index_jobs_by_status" ON "jobs" ("status");
|
||||
CREATE TABLE "reviews" (
|
||||
"id" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||
"event_id" BIGINT NOT NULL,
|
||||
"repo" TEXT NOT NULL,
|
||||
"pr" BIGINT NOT NULL,
|
||||
"ok" BOOLEAN NOT NULL,
|
||||
"model" TEXT NOT NULL,
|
||||
"markdown" TEXT NOT NULL,
|
||||
"cost" DOUBLE PRECISION,
|
||||
"comments" BIGINT NOT NULL,
|
||||
"duration_ms" BIGINT NOT NULL,
|
||||
"completed_at" TIMESTAMPTZ(6) NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
CREATE UNIQUE INDEX "index_reviews_by_event_id" ON "reviews" ("event_id");
|
||||
@@ -0,0 +1,160 @@
|
||||
version = 1
|
||||
|
||||
[schema]
|
||||
|
||||
[[schema.tables]]
|
||||
id = 0
|
||||
name = "jobs"
|
||||
primary_key = { columns = [{ table = 0, index = 0 }], index = { table = 0, index = 0 } }
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 0, index = 0 }
|
||||
name = "id"
|
||||
ty = "U64"
|
||||
storage_ty = { UnsignedInteger = 8 }
|
||||
auto_increment = true
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 0, index = 1 }
|
||||
name = "event_id"
|
||||
ty = "U64"
|
||||
storage_ty = { UnsignedInteger = 8 }
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 0, index = 2 }
|
||||
name = "repo"
|
||||
ty = "String"
|
||||
storage_ty = "Text"
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 0, index = 3 }
|
||||
name = "pr"
|
||||
ty = "U64"
|
||||
storage_ty = { UnsignedInteger = 8 }
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 0, index = 4 }
|
||||
name = "payload"
|
||||
ty = "String"
|
||||
storage_ty = "Jsonb"
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 0, index = 5 }
|
||||
name = "status"
|
||||
ty = "String"
|
||||
storage_ty = { Enum = { name = "job_status", variants = [{ name = "pending" }, { name = "processing" }] } }
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 0, index = 6 }
|
||||
name = "created_at"
|
||||
ty = "Timestamp"
|
||||
storage_ty = { Timestamp = 6 }
|
||||
|
||||
[[schema.tables.indices]]
|
||||
id = { table = 0, index = 0 }
|
||||
name = "index_jobs_by_id"
|
||||
on = 0
|
||||
columns = [{ column = { table = 0, index = 0 }, op = "Eq", scope = "Partition" }]
|
||||
unique = true
|
||||
primary_key = true
|
||||
|
||||
[[schema.tables.indices]]
|
||||
id = { table = 0, index = 1 }
|
||||
name = "index_jobs_by_event_id"
|
||||
on = 0
|
||||
columns = [{ column = { table = 0, index = 1 }, op = "Eq", scope = "Partition" }]
|
||||
unique = true
|
||||
|
||||
[[schema.tables.indices]]
|
||||
id = { table = 0, index = 2 }
|
||||
name = "index_jobs_by_status"
|
||||
on = 0
|
||||
columns = [{ column = { table = 0, index = 5 }, op = "Eq", scope = "Partition" }]
|
||||
|
||||
[[schema.tables]]
|
||||
id = 1
|
||||
name = "reviews"
|
||||
primary_key = { columns = [{ table = 1, index = 0 }], index = { table = 1, index = 0 } }
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 1, index = 0 }
|
||||
name = "id"
|
||||
ty = "U64"
|
||||
storage_ty = { UnsignedInteger = 8 }
|
||||
auto_increment = true
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 1, index = 1 }
|
||||
name = "event_id"
|
||||
ty = "U64"
|
||||
storage_ty = { UnsignedInteger = 8 }
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 1, index = 2 }
|
||||
name = "repo"
|
||||
ty = "String"
|
||||
storage_ty = "Text"
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 1, index = 3 }
|
||||
name = "pr"
|
||||
ty = "U64"
|
||||
storage_ty = { UnsignedInteger = 8 }
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 1, index = 4 }
|
||||
name = "ok"
|
||||
ty = "Bool"
|
||||
storage_ty = "Boolean"
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 1, index = 5 }
|
||||
name = "model"
|
||||
ty = "String"
|
||||
storage_ty = "Text"
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 1, index = 6 }
|
||||
name = "markdown"
|
||||
ty = "String"
|
||||
storage_ty = "Text"
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 1, index = 7 }
|
||||
name = "cost"
|
||||
ty = "F64"
|
||||
storage_ty = { Float = 8 }
|
||||
nullable = true
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 1, index = 8 }
|
||||
name = "comments"
|
||||
ty = "U64"
|
||||
storage_ty = { UnsignedInteger = 8 }
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 1, index = 9 }
|
||||
name = "duration_ms"
|
||||
ty = "U64"
|
||||
storage_ty = { UnsignedInteger = 8 }
|
||||
|
||||
[[schema.tables.columns]]
|
||||
id = { table = 1, index = 10 }
|
||||
name = "completed_at"
|
||||
ty = "Timestamp"
|
||||
storage_ty = { Timestamp = 6 }
|
||||
|
||||
[[schema.tables.indices]]
|
||||
id = { table = 1, index = 0 }
|
||||
name = "index_reviews_by_id"
|
||||
on = 1
|
||||
columns = [{ column = { table = 1, index = 0 }, op = "Eq", scope = "Partition" }]
|
||||
unique = true
|
||||
primary_key = true
|
||||
|
||||
[[schema.tables.indices]]
|
||||
id = { table = 1, index = 1 }
|
||||
name = "index_reviews_by_event_id"
|
||||
on = 1
|
||||
columns = [{ column = { table = 1, index = 1 }, op = "Eq", scope = "Partition" }]
|
||||
unique = true
|
||||
Reference in new issue
Block a user