Skip to content

Commit

Permalink
fix: reset migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorpfiz committed May 17, 2024
1 parent 6f6cfb6 commit 5f97ede
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ CREATE TABLE IF NOT EXISTS "wc_profile" (
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "wc_report" (
"id" serial PRIMARY KEY NOT NULL,
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"title" varchar(256) NOT NULL,
"content" text NOT NULL,
"profile_id" uuid NOT NULL,
"created_at" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL,
"updated_at" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone
);
--> statement-breakpoint
DO $$ BEGIN
Expand All @@ -25,7 +25,7 @@ EXCEPTION
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "wc_report" ADD CONSTRAINT "wc_report_profile_id_wc_profile_id_fk" FOREIGN KEY ("profile_id") REFERENCES "wc_profile"("id") ON DELETE no action ON UPDATE no action;
ALTER TABLE "wc_report" ADD CONSTRAINT "wc_report_profile_id_wc_profile_id_fk" FOREIGN KEY ("profile_id") REFERENCES "public"."wc_profile"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
36 changes: 18 additions & 18 deletions packages/db/migrations/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"id": "4ef33f95-48ee-48b7-91fc-e59d7efae202",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "6",
"dialect": "postgresql",
"tables": {
Expand Down Expand Up @@ -52,16 +54,16 @@
"wc_profile_id_users_id_fk": {
"name": "wc_profile_id_users_id_fk",
"tableFrom": "wc_profile",
"tableTo": "users",
"schemaTo": "auth",
"columnsFrom": [
"id"
],
"tableTo": "users",
"schemaTo": "auth",
"columnsTo": [
"id"
],
"onUpdate": "no action",
"onDelete": "cascade"
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
Expand All @@ -73,9 +75,10 @@
"columns": {
"id": {
"name": "id",
"type": "serial",
"type": "uuid",
"primaryKey": true,
"notNull": true
"notNull": true,
"default": "gen_random_uuid()"
},
"title": {
"name": "title",
Expand All @@ -100,30 +103,29 @@
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "CURRENT_TIMESTAMP"
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"wc_report_profile_id_wc_profile_id_fk": {
"name": "wc_report_profile_id_wc_profile_id_fk",
"tableFrom": "wc_report",
"tableTo": "wc_profile",
"columnsFrom": [
"profile_id"
],
"tableTo": "wc_profile",
"columnsTo": [
"id"
],
"onUpdate": "no action",
"onDelete": "no action"
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
Expand All @@ -133,10 +135,8 @@
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {},
"columns": {}
},
"id": "225a9ba0-acad-4d5c-ac65-73a6d7d8af6a",
"prevId": "00000000-0000-0000-0000-000000000000"
"tables": {}
}
}
12 changes: 6 additions & 6 deletions packages/db/migrations/meta/_journal.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"version": "5",
"dialect": "pg",
"version": "6",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "5",
"when": 1715131176564,
"tag": "0000_brainy_lila_cheney",
"version": "6",
"when": 1715916709318,
"tag": "0000_steady_rictor",
"breakpoints": true
}
]
}
}
2 changes: 1 addition & 1 deletion packages/db/src/schema/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const Report = createTable("report", {
createdAt: timestamp("created_at")
.default(sql`now()`)
.notNull(),
updatedAt: timestamp("updatedAt", {
updatedAt: timestamp("updated_at", {
mode: "date",
withTimezone: true,
}).$onUpdateFn(() => sql`now()`),
Expand Down

0 comments on commit 5f97ede

Please sign in to comment.