From e24da799d0c9d1e833dea73235d9bee99d6deb89 Mon Sep 17 00:00:00 2001 From: RainbowBird Date: Thu, 26 Mar 2026 23:31:24 +0800 Subject: [PATCH] fix(server): squash drizzle schema --- apps/server/drizzle/0005_skinny_leech.sql | 4 +- apps/server/src/schemas/auth.ts | 93 ----------------------- pnpm-workspace.yaml | 1 - 3 files changed, 3 insertions(+), 95 deletions(-) delete mode 100644 apps/server/src/schemas/auth.ts diff --git a/apps/server/drizzle/0005_skinny_leech.sql b/apps/server/drizzle/0005_skinny_leech.sql index 35c819172..74d42fe73 100644 --- a/apps/server/drizzle/0005_skinny_leech.sql +++ b/apps/server/drizzle/0005_skinny_leech.sql @@ -42,4 +42,6 @@ CREATE UNIQUE INDEX "flux_ledger_user_request_uniq" ON "flux_ledger" USING btree CREATE UNIQUE INDEX "outbox_events_event_id_idx" ON "outbox_events" USING btree ("event_id");--> statement-breakpoint CREATE INDEX "outbox_events_publish_scan_idx" ON "outbox_events" USING btree ("published_at","available_at","claim_expires_at","created_at");--> statement-breakpoint CREATE INDEX "outbox_events_claimed_by_idx" ON "outbox_events" USING btree ("claimed_by");--> statement-breakpoint -ALTER TABLE "llm_request_log" DROP COLUMN "settled"; \ No newline at end of file +ALTER TABLE "llm_request_log" DROP COLUMN "settled"; +--> statement-breakpoint +ALTER TABLE "stripe_subscription" ALTER COLUMN "cancel_at_period_end" SET DATA TYPE boolean; diff --git a/apps/server/src/schemas/auth.ts b/apps/server/src/schemas/auth.ts deleted file mode 100644 index b638d8438..000000000 --- a/apps/server/src/schemas/auth.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { relations } from 'drizzle-orm' -import { boolean, index, pgTable, text, timestamp } 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').default(false).notNull(), - image: text('image'), - createdAt: timestamp('created_at').defaultNow().notNull(), - updatedAt: timestamp('updated_at') - .defaultNow() - .$onUpdate(() => /* @__PURE__ */ new Date()) - .notNull(), -}) - -export const session = pgTable( - 'session', - { - id: text('id').primaryKey(), - expiresAt: timestamp('expires_at').notNull(), - token: text('token').notNull().unique(), - createdAt: timestamp('created_at').defaultNow().notNull(), - updatedAt: timestamp('updated_at') - .$onUpdate(() => /* @__PURE__ */ new Date()) - .notNull(), - ipAddress: text('ip_address'), - userAgent: text('user_agent'), - userId: text('user_id') - .notNull() - .references(() => user.id, { onDelete: 'cascade' }), - }, - table => [index('session_userId_idx').on(table.userId)], -) - -export const account = pgTable( - 'account', - { - id: text('id').primaryKey(), - accountId: text('account_id').notNull(), - providerId: text('provider_id').notNull(), - userId: text('user_id') - .notNull() - .references(() => user.id, { onDelete: 'cascade' }), - accessToken: text('access_token'), - refreshToken: text('refresh_token'), - idToken: text('id_token'), - accessTokenExpiresAt: timestamp('access_token_expires_at'), - refreshTokenExpiresAt: timestamp('refresh_token_expires_at'), - scope: text('scope'), - password: text('password'), - createdAt: timestamp('created_at').defaultNow().notNull(), - updatedAt: timestamp('updated_at') - .$onUpdate(() => /* @__PURE__ */ new Date()) - .notNull(), - }, - table => [index('account_userId_idx').on(table.userId)], -) - -export const verification = pgTable( - 'verification', - { - id: text('id').primaryKey(), - identifier: text('identifier').notNull(), - value: text('value').notNull(), - expiresAt: timestamp('expires_at').notNull(), - createdAt: timestamp('created_at').defaultNow().notNull(), - updatedAt: timestamp('updated_at') - .defaultNow() - .$onUpdate(() => /* @__PURE__ */ new Date()) - .notNull(), - }, - table => [index('verification_identifier_idx').on(table.identifier)], -) - -export const userRelations = relations(user, ({ many }) => ({ - sessions: many(session), - accounts: many(account), -})) - -export const sessionRelations = relations(session, ({ one }) => ({ - user: one(user, { - fields: [session.userId], - references: [user.id], - }), -})) - -export const accountRelations = relations(account, ({ one }) => ({ - user: one(user, { - fields: [account.userId], - references: [user.id], - }), -})) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index cbd5116b3..36a507f45 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -126,7 +126,6 @@ catalogs: vitest: ^4.1.1 xsai: unspeech: ^0.1.11 -enableGlobalVirtualStore: true ignoredBuiltDependencies: - '@prisma/client'