diff --git a/.env.production b/.env.production index 6d26db5..2103848 100644 --- a/.env.production +++ b/.env.production @@ -2,7 +2,7 @@ # Hosting # Replace by your domain name -NEXT_PUBLIC_APP_URL=https://example.com +# NEXT_PUBLIC_APP_URL=https://example.com # Sentry DSN NEXT_PUBLIC_SENTRY_DSN= diff --git a/src/libs/DB.ts b/src/libs/DB.ts index 0c8eda2..5c47440 100644 --- a/src/libs/DB.ts +++ b/src/libs/DB.ts @@ -1,7 +1,6 @@ import { PGlite } from '@electric-sql/pglite'; import { drizzle as drizzlePg } from 'drizzle-orm/node-postgres'; import { migrate as migratePg } from 'drizzle-orm/node-postgres/migrator'; -import type { PgDatabase } from 'drizzle-orm/pg-core'; import { drizzle as drizzlePglite } from 'drizzle-orm/pglite'; import { migrate as migratePglite } from 'drizzle-orm/pglite/migrator'; import { PHASE_PRODUCTION_BUILD } from 'next/dist/shared/lib/constants'; @@ -13,7 +12,7 @@ import * as schema from '@/models/Schema'; import { Env } from './Env'; let client; -let drizzle: PgDatabase; +let drizzle; if (process.env.NEXT_PHASE !== PHASE_PRODUCTION_BUILD && Env.DATABASE_URL) { client = new Client({ diff --git a/src/libs/Env.ts b/src/libs/Env.ts index 6dce17e..20899a9 100644 --- a/src/libs/Env.ts +++ b/src/libs/Env.ts @@ -18,7 +18,7 @@ export const Env = createEnv({ NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: z.string().min(1), }, shared: { - NODE_ENV: z.enum(['development', 'production']), + NODE_ENV: z.enum(['test', 'development', 'production']), }, // You need to destructure all the keys manually runtimeEnv: { diff --git a/src/models/Schema.ts b/src/models/Schema.ts index cc8e66a..f83c363 100644 --- a/src/models/Schema.ts +++ b/src/models/Schema.ts @@ -1,5 +1,5 @@ import { - integer, + bigint, pgTable, serial, text, @@ -10,13 +10,14 @@ import { export const organizationSchema = pgTable( 'organization', { - id: serial('id'), + id: text('id').primaryKey(), stripeCustomerId: text('stripe_customer_id'), stripeSubscriptionId: text('stripe_subscription_id'), stripeSubscriptionPriceId: text('stripe_subscription_price_id'), stripeSubscriptionStatus: text('stripe_subscription_status'), - stripeSubscriptionCurrentPeriodEnd: integer( + stripeSubscriptionCurrentPeriodEnd: bigint( 'stripe_subscription_current_period_end', + { mode: 'number' }, ), updatedAt: timestamp('updated_at', { mode: 'date' }) .defaultNow() @@ -34,7 +35,7 @@ export const organizationSchema = pgTable( ); export const todoSchema = pgTable('todo', { - id: serial('id'), + id: serial('id').primaryKey(), ownerId: text('owner_id').notNull(), title: text('title').notNull(), message: text('message').notNull(),