Skip to content

Commit

Permalink
feat: create user table (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
aamirazad authored Jun 5, 2024
1 parent 6be1665 commit 063a6e8
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions src/server/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

import { sql } from "drizzle-orm";
import {
index,
pgTableCreator,
serial,
timestamp,
varchar,
} from "drizzle-orm/pg-core";

Expand All @@ -16,19 +14,14 @@ import {
*
* @see https://orm.drizzle.team/docs/goodies#multi-project-schema
*/
export const createTable = pgTableCreator((name) => `homelab-connector_${name}`);

export const immich = createTable(
"post",
{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
createdAt: timestamp("created_at", { withTimezone: true })
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
updatedAt: timestamp("updatedAt", { withTimezone: true }),
},
(example) => ({
nameIndex: index("name_idx").on(example.name),
})
export const createTable = pgTableCreator(
(name) => `homelab-connector_${name}`,
);

export const users = createTable("users", {
id: serial("id").primaryKey(),
userId: varchar("userId", { length: 256 }).notNull(),
fullName: varchar("name", { length: 256 }),
paperlessURL: varchar("paperlessURL", { length: 256 }),
paperlessAPI: varchar("paperlessAPI", { length: 256 }),
});

0 comments on commit 063a6e8

Please sign in to comment.