mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-02 12:49:20 +01:00
61 lines
1.6 KiB
TypeScript
61 lines
1.6 KiB
TypeScript
import type { InferSelectModel } from "drizzle-orm";
|
|
|
|
import { env } from "../env";
|
|
import * as mysqlSchema from "./mysql";
|
|
import * as pgSchema from "./postgresql";
|
|
import * as sqliteSchema from "./sqlite";
|
|
|
|
export type PostgreSqlSchema = typeof pgSchema;
|
|
export type MySqlSchema = typeof mysqlSchema;
|
|
type Schema = typeof sqliteSchema;
|
|
|
|
const schema =
|
|
env.DB_DRIVER === "mysql2"
|
|
? (mysqlSchema as unknown as Schema)
|
|
: env.DB_DRIVER === "node-postgres"
|
|
? (pgSchema as unknown as Schema)
|
|
: sqliteSchema;
|
|
|
|
// Sadly we can't use export * from here as we have multiple possible exports
|
|
export const {
|
|
accounts,
|
|
apiKeys,
|
|
apps,
|
|
boardGroupPermissions,
|
|
boardUserPermissions,
|
|
boards,
|
|
groupMembers,
|
|
groupPermissions,
|
|
groups,
|
|
iconRepositories,
|
|
icons,
|
|
integrationGroupPermissions,
|
|
integrationItems,
|
|
integrationSecrets,
|
|
integrationUserPermissions,
|
|
integrations,
|
|
invites,
|
|
items,
|
|
medias,
|
|
onboarding,
|
|
searchEngines,
|
|
sections,
|
|
serverSettings,
|
|
sessions,
|
|
users,
|
|
verificationTokens,
|
|
sectionCollapseStates,
|
|
layouts,
|
|
itemLayouts,
|
|
sectionLayouts,
|
|
trustedCertificateHostnames,
|
|
cronJobConfigurations,
|
|
} = schema;
|
|
|
|
export type User = InferSelectModel<typeof schema.users>;
|
|
export type Account = InferSelectModel<typeof schema.accounts>;
|
|
export type Session = InferSelectModel<typeof schema.sessions>;
|
|
export type VerificationToken = InferSelectModel<typeof schema.verificationTokens>;
|
|
export type Integration = InferSelectModel<typeof schema.integrations>;
|
|
export type IntegrationSecret = InferSelectModel<typeof schema.integrationSecrets>;
|