fix: error in schema
Some checks failed
Deploy to GitHub Pages / build_site (push) Failing after 36s

This commit is contained in:
max_richter 2024-12-20 12:46:44 +01:00
parent 2814165ee6
commit ec037a3bbd
5 changed files with 11 additions and 10 deletions

View File

@ -15,7 +15,7 @@ CREATE TABLE "nodes" (
"previous" varchar(8)
);
--> statement-breakpoint
ALTER TABLE "nodes" ADD CONSTRAINT "nodes_userId_users_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "nodes" ADD CONSTRAINT "nodes_userId_users_name_fk" FOREIGN KEY ("userId") REFERENCES "public"."users"("name") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "nodes" ADD CONSTRAINT "node_previous_fk" FOREIGN KEY ("previous") REFERENCES "public"."nodes"("hash") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "user_id_idx" ON "nodes" USING btree ("userId");--> statement-breakpoint
CREATE INDEX "system_id_idx" ON "nodes" USING btree ("systemId");--> statement-breakpoint

View File

@ -1,5 +1,5 @@
{
"id": "91f8730d-dd5a-4a25-b840-e42b0ef1bc72",
"id": "e0d14457-de6a-4832-80fd-ee24523ff95c",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
@ -154,15 +154,15 @@
}
},
"foreignKeys": {
"nodes_userId_users_id_fk": {
"name": "nodes_userId_users_id_fk",
"nodes_userId_users_name_fk": {
"name": "nodes_userId_users_name_fk",
"tableFrom": "nodes",
"tableTo": "users",
"columnsFrom": [
"userId"
],
"columnsTo": [
"id"
"name"
],
"onDelete": "no action",
"onUpdate": "no action"

View File

@ -5,8 +5,8 @@
{
"idx": 0,
"version": "7",
"when": 1734694927055,
"tag": "0000_clever_odin",
"when": 1734695191817,
"tag": "0000_wakeful_zodiak",
"breakpoints": true
}
]

View File

@ -16,6 +16,7 @@ export const db = drizzle({
schema,
});
export function migrateDb() {
return migrate(db, { migrationsFolder: "drizzle" });
export async function migrateDb() {
await migrate(db, { migrationsFolder: "drizzle" });
console.log("Database migrated");
}

View File

@ -22,7 +22,7 @@ const bytea = customType<{
export const nodeTable = pgTable("nodes", {
id: serial().primaryKey(),
userId: varchar().notNull().references(() => usersTable.id),
userId: varchar().notNull().references(() => usersTable.name),
systemId: varchar().notNull(),
nodeId: varchar().notNull(),
content: bytea().notNull(),