From a6567828bddfb60c6c9dbc4ca9d6251319904b91 Mon Sep 17 00:00:00 2001 From: moonlitgrace Date: Wed, 9 Oct 2024 13:32:54 +0530 Subject: [PATCH] refactor(db): posts schema and prod push script --- ...t_smasher.sql => 0000_flimsy_bloodaxe.sql} | 2 +- db/migrations/0001_stormy_energizer.sql | 1 - db/migrations/meta/0000_snapshot.json | 5 +- db/migrations/meta/0001_snapshot.json | 82 ------------------- db/migrations/meta/_journal.json | 11 +-- package.json | 1 + 6 files changed, 6 insertions(+), 96 deletions(-) rename db/migrations/{0000_silent_smasher.sql => 0000_flimsy_bloodaxe.sql} (84%) delete mode 100644 db/migrations/0001_stormy_energizer.sql delete mode 100644 db/migrations/meta/0001_snapshot.json diff --git a/db/migrations/0000_silent_smasher.sql b/db/migrations/0000_flimsy_bloodaxe.sql similarity index 84% rename from db/migrations/0000_silent_smasher.sql rename to db/migrations/0000_flimsy_bloodaxe.sql index 6c30d44..e05b117 100644 --- a/db/migrations/0000_silent_smasher.sql +++ b/db/migrations/0000_flimsy_bloodaxe.sql @@ -5,7 +5,7 @@ CREATE TABLE IF NOT EXISTS "posts" ( "tag" text NOT NULL, "cover" text, "content" text NOT NULL, - "description" text DEFAULT 'default:' NOT NULL, + "description" text NOT NULL, "created_at" timestamp DEFAULT now() NOT NULL, "draft" boolean DEFAULT false NOT NULL ); diff --git a/db/migrations/0001_stormy_energizer.sql b/db/migrations/0001_stormy_energizer.sql deleted file mode 100644 index cfe0444..0000000 --- a/db/migrations/0001_stormy_energizer.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "posts" ALTER COLUMN "description" DROP DEFAULT; \ No newline at end of file diff --git a/db/migrations/meta/0000_snapshot.json b/db/migrations/meta/0000_snapshot.json index 0246c4d..21a8287 100644 --- a/db/migrations/meta/0000_snapshot.json +++ b/db/migrations/meta/0000_snapshot.json @@ -1,5 +1,5 @@ { - "id": "04cf5614-0ac7-4007-8d19-a50f67424b29", + "id": "3b0fe357-e666-45c7-93ff-b2411e6eedc8", "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", @@ -48,8 +48,7 @@ "name": "description", "type": "text", "primaryKey": false, - "notNull": true, - "default": "'default:'" + "notNull": true }, "created_at": { "name": "created_at", diff --git a/db/migrations/meta/0001_snapshot.json b/db/migrations/meta/0001_snapshot.json deleted file mode 100644 index 212eb9d..0000000 --- a/db/migrations/meta/0001_snapshot.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "id": "013ff335-d84d-4aa4-bcd6-5da5816bc397", - "prevId": "04cf5614-0ac7-4007-8d19-a50f67424b29", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.posts": { - "name": "posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tag": { - "name": "tag", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "cover": { - "name": "cover", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "draft": { - "name": "draft", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/db/migrations/meta/_journal.json b/db/migrations/meta/_journal.json index 08feaa5..583a030 100644 --- a/db/migrations/meta/_journal.json +++ b/db/migrations/meta/_journal.json @@ -5,15 +5,8 @@ { "idx": 0, "version": "7", - "when": 1728442840815, - "tag": "0000_silent_smasher", - "breakpoints": true - }, - { - "idx": 1, - "version": "7", - "when": 1728443335073, - "tag": "0001_stormy_energizer", + "when": 1728460893082, + "tag": "0000_flimsy_bloodaxe", "breakpoints": true } ] diff --git a/package.json b/package.json index 264b62b..d5d78e0 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "db:migrate": "drizzle-kit migrate --config=./drizzle.config.ts", "db:migrate:prod": "cross-env NODE_ENV=production dotenvx run -f .env.production.local -- drizzle-kit migrate --config=./drizzle.config.ts", "db:push": "drizzle-kit push --config=./drizzle.config.ts", + "db:push:prod": "cross-env NODE_ENV=production dotenvx run -f .env.production.local -- drizzle-kit push --config=./drizzle.config.ts", "db:studio": "drizzle-kit studio --config=./drizzle.config.ts", "prepare": "husky" },