From 7e6c9ab2fea6fb680163128adf60796399538ccf Mon Sep 17 00:00:00 2001 From: Mahmoud Abdelwahab Date: Fri, 2 Feb 2024 10:40:26 +0200 Subject: [PATCH] Add is_subscribed column to user table --- drizzle/0001_yielding_obadiah_stane.sql | 1 + drizzle/meta/0001_snapshot.json | 74 +++++++++++++++++++++++++ drizzle/meta/_journal.json | 7 +++ src/db/schema.ts | 3 +- 4 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 drizzle/0001_yielding_obadiah_stane.sql create mode 100644 drizzle/meta/0001_snapshot.json diff --git a/drizzle/0001_yielding_obadiah_stane.sql b/drizzle/0001_yielding_obadiah_stane.sql new file mode 100644 index 0000000..e6753c9 --- /dev/null +++ b/drizzle/0001_yielding_obadiah_stane.sql @@ -0,0 +1 @@ +ALTER TABLE "user" ADD COLUMN "is_subscribed" boolean DEFAULT true; \ No newline at end of file diff --git a/drizzle/meta/0001_snapshot.json b/drizzle/meta/0001_snapshot.json new file mode 100644 index 0000000..4925a7b --- /dev/null +++ b/drizzle/meta/0001_snapshot.json @@ -0,0 +1,74 @@ +{ + "id": "162732f1-7eb9-4376-ae40-72a4b2d0adb7", + "prevId": "82aee2f3-0a69-43a7-ae90-c5b40ac2d1cf", + "version": "5", + "dialect": "pg", + "tables": { + "user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "is_subscribed": { + "name": "is_subscribed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index c219c27..10a310d 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -8,6 +8,13 @@ "when": 1706770281659, "tag": "0000_goofy_gabe_jones", "breakpoints": true + }, + { + "idx": 1, + "version": "5", + "when": 1706863190661, + "tag": "0001_yielding_obadiah_stane", + "breakpoints": true } ] } \ No newline at end of file diff --git a/src/db/schema.ts b/src/db/schema.ts index 5b21662..f51452c 100644 --- a/src/db/schema.ts +++ b/src/db/schema.ts @@ -1,4 +1,4 @@ -import { serial, text, timestamp, pgTable } from "drizzle-orm/pg-core"; +import { serial, text, timestamp, pgTable, boolean } from "drizzle-orm/pg-core"; export const users = pgTable("user", { id: serial("id"), @@ -8,4 +8,5 @@ export const users = pgTable("user", { role: text("role").$type<"admin" | "customer">(), createdAt: timestamp("created_at"), updatedAt: timestamp("updated_at"), + isSubscribed: boolean("is_subscribed").default(true), });