You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1009 B
35 lines
1009 B
import { index, integer, primaryKey, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
|
import { users } from "./auth";
|
|
|
|
export const appConfigs = sqliteTable("app_configs", {
|
|
key: text().primaryKey(),
|
|
value: text().notNull(),
|
|
valueType: text("value_type").notNull(),
|
|
updatedAt: integer("updated_at", { mode: "timestamp_ms" })
|
|
.defaultNow()
|
|
.$onUpdate(() => new Date())
|
|
.notNull(),
|
|
});
|
|
|
|
export const userConfigs = sqliteTable(
|
|
"user_configs",
|
|
{
|
|
userId: integer("user_id")
|
|
.notNull()
|
|
.references(() => users.id, { onDelete: "cascade" }),
|
|
key: text().notNull(),
|
|
value: text().notNull(),
|
|
valueType: text("value_type").notNull(),
|
|
updatedAt: integer("updated_at", { mode: "timestamp_ms" })
|
|
.defaultNow()
|
|
.$onUpdate(() => new Date())
|
|
.notNull(),
|
|
},
|
|
(table) => [
|
|
primaryKey({
|
|
name: "user_configs_user_id_key_pk",
|
|
columns: [table.userId, table.key],
|
|
}),
|
|
index("user_configs_user_id_idx").on(table.userId),
|
|
],
|
|
);
|
|
|