32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { AnyPgColumn, boolean, pgTable, text, timestamp, uuid, index } from 'drizzle-orm/pg-core';
|
|
|
|
export const shops = pgTable('shops', {
|
|
id: uuid('id').defaultRandom().primaryKey(),
|
|
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
|
esApiKey: text('es_api_key').notNull().unique(),
|
|
active: boolean('active').notNull().default(true),
|
|
});
|
|
|
|
export const jobs = pgTable(
|
|
'jobs',
|
|
{
|
|
id: uuid('id').defaultRandom().primaryKey(),
|
|
shopId: uuid('shopId')
|
|
.references((): AnyPgColumn => shops.id)
|
|
.notNull(),
|
|
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
|
clm_no: text('clm_no'),
|
|
ciecaid: text('ciecaid'),
|
|
},
|
|
(table) => [index('clm_no_idx').on(table.clm_no)]
|
|
);
|
|
|
|
export const joblines = pgTable('joblines', {
|
|
id: uuid('id').defaultRandom().primaryKey(),
|
|
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
|
jobId: uuid('jobId')
|
|
.references((): AnyPgColumn => jobs.id)
|
|
.notNull(),
|
|
line_desc: text('line_desc'),
|
|
});
|