feat(migration): add Supabase import and recovery tooling
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
CREATE TABLE `user_preferences` (
|
||||
`owner_user_id` text PRIMARY KEY NOT NULL,
|
||||
`timezone` text DEFAULT 'Europe/Istanbul' NOT NULL,
|
||||
`default_currency` text DEFAULT 'TRY' NOT NULL,
|
||||
`language` text DEFAULT 'tr' NOT NULL,
|
||||
`date_format` text DEFAULT 'dd.MM.yyyy' NOT NULL,
|
||||
`color_mode` text DEFAULT 'system' NOT NULL,
|
||||
`sidebar_collapsed` integer DEFAULT false NOT NULL,
|
||||
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
`updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
FOREIGN KEY (`owner_user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade,
|
||||
CONSTRAINT "user_preferences_currency_check" CHECK(length("user_preferences"."default_currency") = 3),
|
||||
CONSTRAINT "user_preferences_language_check" CHECK("user_preferences"."language" in ('tr', 'en')),
|
||||
CONSTRAINT "user_preferences_color_mode_check" CHECK("user_preferences"."color_mode" in ('light', 'dark', 'system'))
|
||||
);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -43,6 +43,13 @@
|
||||
"when": 1784234752708,
|
||||
"tag": "0005_brief_black_bolt",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 6,
|
||||
"version": "6",
|
||||
"when": 1784266217938,
|
||||
"tag": "0006_moaning_kitty_pryde",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sql } from "drizzle-orm";
|
||||
import { check, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
||||
import { check, integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
||||
import { user } from "./auth";
|
||||
|
||||
export type AiProvider = "gemini" | "openai" | "groq" | "ollama";
|
||||
@@ -23,3 +23,25 @@ export const userAiSettings = sqliteTable(
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
export const userPreferences = sqliteTable(
|
||||
"user_preferences",
|
||||
{
|
||||
ownerUserId: text("owner_user_id")
|
||||
.primaryKey()
|
||||
.references(() => user.id, { onDelete: "cascade" }),
|
||||
timezone: text("timezone").default("Europe/Istanbul").notNull(),
|
||||
defaultCurrency: text("default_currency").default("TRY").notNull(),
|
||||
language: text("language").default("tr").notNull(),
|
||||
dateFormat: text("date_format").default("dd.MM.yyyy").notNull(),
|
||||
colorMode: text("color_mode").default("system").notNull(),
|
||||
sidebarCollapsed: integer("sidebar_collapsed", { mode: "boolean" }).default(false).notNull(),
|
||||
createdAt: text("created_at").default(sql`CURRENT_TIMESTAMP`).notNull(),
|
||||
updatedAt: text("updated_at").default(sql`CURRENT_TIMESTAMP`).notNull(),
|
||||
},
|
||||
(table) => [
|
||||
check("user_preferences_currency_check", sql`length(${table.defaultCurrency}) = 3`),
|
||||
check("user_preferences_language_check", sql`${table.language} in ('tr', 'en')`),
|
||||
check("user_preferences_color_mode_check", sql`${table.colorMode} in ('light', 'dark', 'system')`),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user