and so it begins
This commit is contained in:
10
packages/db/migrations/0004_parched_blue_shield.sql
Normal file
10
packages/db/migrations/0004_parched_blue_shield.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
ALTER TABLE "account" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint
|
||||
ALTER TABLE "user" ALTER COLUMN "email_verified" SET DEFAULT false;--> statement-breakpoint
|
||||
ALTER TABLE "user" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint
|
||||
ALTER TABLE "user" ALTER COLUMN "updated_at" SET DEFAULT now();--> statement-breakpoint
|
||||
ALTER TABLE "user" ALTER COLUMN "banned" SET DEFAULT false;--> statement-breakpoint
|
||||
ALTER TABLE "user" ALTER COLUMN "discount_percent" SET DEFAULT 0;--> statement-breakpoint
|
||||
ALTER TABLE "verification" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint
|
||||
ALTER TABLE "verification" ALTER COLUMN "created_at" SET NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "verification" ALTER COLUMN "updated_at" SET DEFAULT now();--> statement-breakpoint
|
||||
ALTER TABLE "verification" ALTER COLUMN "updated_at" SET NOT NULL;
|
||||
9
packages/db/migrations/0005_great_doomsday.sql
Normal file
9
packages/db/migrations/0005_great_doomsday.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
CREATE TABLE IF NOT EXISTS "product" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"title" varchar(64) NOT NULL,
|
||||
"description" text NOT NULL,
|
||||
"long_description" text NOT NULL,
|
||||
"price" numeric(12, 2) DEFAULT '0',
|
||||
"created_at" timestamp DEFAULT now(),
|
||||
"updated_at" timestamp DEFAULT now()
|
||||
);
|
||||
1
packages/db/migrations/0006_puzzling_avengers.sql
Normal file
1
packages/db/migrations/0006_puzzling_avengers.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE "product" ADD COLUMN "discount_price" numeric(12, 2) DEFAULT '0';
|
||||
1496
packages/db/migrations/meta/0004_snapshot.json
Normal file
1496
packages/db/migrations/meta/0004_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
1554
packages/db/migrations/meta/0005_snapshot.json
Normal file
1554
packages/db/migrations/meta/0005_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
1561
packages/db/migrations/meta/0006_snapshot.json
Normal file
1561
packages/db/migrations/meta/0006_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,27 @@
|
||||
"when": 1746375159329,
|
||||
"tag": "0003_unique_stephen_strange",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 4,
|
||||
"version": "7",
|
||||
"when": 1760973109915,
|
||||
"tag": "0004_parched_blue_shield",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 5,
|
||||
"version": "7",
|
||||
"when": 1760975750129,
|
||||
"tag": "0005_great_doomsday",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 6,
|
||||
"version": "7",
|
||||
"when": 1760975763245,
|
||||
"tag": "0006_puzzling_avengers",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,27 +1,30 @@
|
||||
import {
|
||||
boolean,
|
||||
integer,
|
||||
pgTable,
|
||||
text,
|
||||
timestamp,
|
||||
boolean,
|
||||
integer,
|
||||
} from "drizzle-orm/pg-core";
|
||||
|
||||
export const user = pgTable("user", {
|
||||
id: text("id").primaryKey(),
|
||||
name: text("name").notNull(),
|
||||
email: text("email").notNull().unique(),
|
||||
emailVerified: boolean("email_verified").notNull(),
|
||||
emailVerified: boolean("email_verified").default(false).notNull(),
|
||||
image: text("image"),
|
||||
createdAt: timestamp("created_at").notNull(),
|
||||
updatedAt: timestamp("updated_at").notNull(),
|
||||
createdAt: timestamp("created_at").defaultNow().notNull(),
|
||||
updatedAt: timestamp("updated_at")
|
||||
.defaultNow()
|
||||
.$onUpdate(() => /* @__PURE__ */ new Date())
|
||||
.notNull(),
|
||||
username: text("username").unique(),
|
||||
displayUsername: text("display_username"),
|
||||
role: text("role"),
|
||||
banned: boolean("banned"),
|
||||
banned: boolean("banned").default(false),
|
||||
banReason: text("ban_reason"),
|
||||
banExpires: timestamp("ban_expires"),
|
||||
parentId: text("parent_id"),
|
||||
discountPercent: integer("discount_percent"),
|
||||
discount_percent: integer("discount_percent").default(0),
|
||||
});
|
||||
|
||||
export const account = pgTable("account", {
|
||||
@@ -38,8 +41,10 @@ export const account = pgTable("account", {
|
||||
refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
|
||||
scope: text("scope"),
|
||||
password: text("password"),
|
||||
createdAt: timestamp("created_at").notNull(),
|
||||
updatedAt: timestamp("updated_at").notNull(),
|
||||
createdAt: timestamp("created_at").defaultNow().notNull(),
|
||||
updatedAt: timestamp("updated_at")
|
||||
.$onUpdate(() => /* @__PURE__ */ new Date())
|
||||
.notNull(),
|
||||
});
|
||||
|
||||
export const verification = pgTable("verification", {
|
||||
@@ -47,6 +52,9 @@ export const verification = pgTable("verification", {
|
||||
identifier: text("identifier").notNull(),
|
||||
value: text("value").notNull(),
|
||||
expiresAt: timestamp("expires_at").notNull(),
|
||||
createdAt: timestamp("created_at"),
|
||||
updatedAt: timestamp("updated_at"),
|
||||
createdAt: timestamp("created_at").defaultNow().notNull(),
|
||||
updatedAt: timestamp("updated_at")
|
||||
.defaultNow()
|
||||
.$onUpdate(() => /* @__PURE__ */ new Date())
|
||||
.notNull(),
|
||||
});
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { relations } from "drizzle-orm";
|
||||
import {
|
||||
pgTable,
|
||||
serial,
|
||||
varchar,
|
||||
decimal,
|
||||
boolean,
|
||||
timestamp,
|
||||
date,
|
||||
decimal,
|
||||
integer,
|
||||
json,
|
||||
pgTable,
|
||||
serial,
|
||||
text,
|
||||
date,
|
||||
timestamp,
|
||||
varchar,
|
||||
} from "drizzle-orm/pg-core";
|
||||
import { user } from "./auth.out";
|
||||
import { relations } from "drizzle-orm";
|
||||
|
||||
export * from "./auth.out";
|
||||
|
||||
@@ -60,6 +60,21 @@ export const order = pgTable("order", {
|
||||
updatedAt: timestamp("updated_at").defaultNow(),
|
||||
});
|
||||
|
||||
export const product = pgTable("product", {
|
||||
id: serial("id").primaryKey(),
|
||||
title: varchar("title", { length: 64 }).notNull(),
|
||||
description: text("description").notNull(),
|
||||
longDescription: text("long_description").notNull(),
|
||||
price: decimal("price", { precision: 12, scale: 2 })
|
||||
.$type<string>()
|
||||
.default("0"),
|
||||
discountPrice: decimal("discount_price", { precision: 12, scale: 2 })
|
||||
.$type<string>()
|
||||
.default("0"),
|
||||
createdAt: timestamp("created_at").defaultNow(),
|
||||
updatedAt: timestamp("updated_at").defaultNow(),
|
||||
});
|
||||
|
||||
export const passengerPII = pgTable("passenger_pii", {
|
||||
id: serial("id").primaryKey(),
|
||||
firstName: varchar("first_name", { length: 64 }).notNull(),
|
||||
|
||||
Reference in New Issue
Block a user