Files
wg-easy-ca-lose/src/server/database/repositories/hooks/schema.ts
T
Bernd Storath e5fb6ff3a6 Fix: OneTimeLinks (#1719)
* fix otls

* one otl per client

* revert some code

* revert some more code, add comments

* adjust migration
2025-03-07 09:16:24 +01:00

26 lines
740 B
TypeScript

import { sql } from 'drizzle-orm';
import { sqliteTable, text } from 'drizzle-orm/sqlite-core';
import { wgInterface } from '../../schema';
export const hooks = sqliteTable('hooks_table', {
/** same as `wgInterface.name` */
id: text()
.primaryKey()
.references(() => wgInterface.name, {
onDelete: 'cascade',
onUpdate: 'cascade',
}),
preUp: text('pre_up').notNull(),
postUp: text('post_up').notNull(),
preDown: text('pre_down').notNull(),
postDown: text('post_down').notNull(),
createdAt: text('created_at')
.notNull()
.default(sql`(CURRENT_TIMESTAMP)`),
updatedAt: text('updated_at')
.notNull()
.default(sql`(CURRENT_TIMESTAMP)`)
.$onUpdate(() => sql`(CURRENT_TIMESTAMP)`),
});