all repos — stealth-developers @ bc6a3b047632237e26cbbcde50d1b5de890b8731

db: rename ticket -> tickets; make channelId optional
vi did:web:vt3e.cat
Wed, 27 May 2026 01:53:17 +0100
commit

bc6a3b047632237e26cbbcde50d1b5de890b8731

parent

4d4c55c85bf6ef04a8f459707047df094ee14f1d

A pkgs/db/drizzle/20260527005228_sour_hercules/migration.sql

@@ -0,0 +1,30 @@

+ALTER TABLE `tickets` RENAME COLUMN `private_notes` TO `private_reason`;--> statement-breakpoint +PRAGMA foreign_keys=OFF;--> statement-breakpoint +CREATE TABLE `__new_tickets` ( + `id` integer PRIMARY KEY AUTOINCREMENT, + `anonymous_id` text NOT NULL, + `status` text NOT NULL, + `channel_id` text, + `close_reason` text, + `private_reason` text, + `opened_at` integer NOT NULL, + `closed_at` integer, + `opened_by` integer NOT NULL, + `open_reason` text, + `subject` integer NOT NULL, + `claimed_by` integer, + `claimed_at` integer, + `thanked_at` integer, + `warned_at` integer, + `last_message_at` integer, + `has_moderator_message` integer, + `has_author_message` integer, + CONSTRAINT `fk_tickets_opened_by_actors_id_fk` FOREIGN KEY (`opened_by`) REFERENCES `actors`(`id`), + CONSTRAINT `fk_tickets_subject_actors_id_fk` FOREIGN KEY (`subject`) REFERENCES `actors`(`id`), + CONSTRAINT `fk_tickets_claimed_by_actors_id_fk` FOREIGN KEY (`claimed_by`) REFERENCES `actors`(`id`) +); +--> statement-breakpoint +INSERT INTO `__new_tickets`(`id`, `anonymous_id`, `status`, `channel_id`, `close_reason`, `private_reason`, `opened_at`, `closed_at`, `opened_by`, `open_reason`, `subject`, `claimed_by`, `claimed_at`, `thanked_at`, `warned_at`, `last_message_at`, `has_moderator_message`, `has_author_message`) SELECT `id`, `anonymous_id`, `status`, `channel_id`, `close_reason`, `private_reason`, `opened_at`, `closed_at`, `opened_by`, `open_reason`, `subject`, `claimed_by`, `claimed_at`, `thanked_at`, `warned_at`, `last_message_at`, `has_moderator_message`, `has_author_message` FROM `tickets`;--> statement-breakpoint +DROP TABLE `tickets`;--> statement-breakpoint +ALTER TABLE `__new_tickets` RENAME TO `tickets`;--> statement-breakpoint +PRAGMA foreign_keys=ON;
A pkgs/db/drizzle/20260527005228_sour_hercules/snapshot.json

@@ -0,0 +1,981 @@

+{ + "version": "7", + "dialect": "sqlite", + "id": "c6ffe18f-3c96-4471-9485-54c1e2bd17c0", + "prevIds": [ + "f1bd9a2e-f82a-4938-9bf2-2bf4ef3c7c61" + ], + "ddl": [ + { + "name": "actors", + "entityType": "tables" + }, + { + "name": "sessions", + "entityType": "tables" + }, + { + "name": "ticket_attachments", + "entityType": "tables" + }, + { + "name": "ticket_messages", + "entityType": "tables" + }, + { + "name": "ticket_participants", + "entityType": "tables" + }, + { + "name": "tickets", + "entityType": "tables" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": true, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "actors" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "discord_id", + "entityType": "columns", + "table": "actors" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "display_name", + "entityType": "columns", + "table": "actors" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "username", + "entityType": "columns", + "table": "actors" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "avatar", + "entityType": "columns", + "table": "actors" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "moderator", + "entityType": "columns", + "table": "actors" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "actors" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "actors" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "deleted_at", + "entityType": "columns", + "table": "actors" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "access_token", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "refresh_token", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "scope", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "token_type", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "expires_at", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": true, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "ticket_attachments" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "public_id", + "entityType": "columns", + "table": "ticket_attachments" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "message_id", + "entityType": "columns", + "table": "ticket_attachments" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "ticket_id", + "entityType": "columns", + "table": "ticket_attachments" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "actor_id", + "entityType": "columns", + "table": "ticket_attachments" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "file_name", + "entityType": "columns", + "table": "ticket_attachments" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "file_type", + "entityType": "columns", + "table": "ticket_attachments" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "file_size", + "entityType": "columns", + "table": "ticket_attachments" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": true, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "ticket_messages" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "public_id", + "entityType": "columns", + "table": "ticket_messages" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "message_id", + "entityType": "columns", + "table": "ticket_messages" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "ticket_id", + "entityType": "columns", + "table": "ticket_messages" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "actor_id", + "entityType": "columns", + "table": "ticket_messages" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "content", + "entityType": "columns", + "table": "ticket_messages" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "actor_role", + "entityType": "columns", + "table": "ticket_messages" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "ticket_messages" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "edited_at", + "entityType": "columns", + "table": "ticket_messages" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "deleted_at", + "entityType": "columns", + "table": "ticket_messages" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": true, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "ticket_participants" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "ticket_id", + "entityType": "columns", + "table": "ticket_participants" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "actor_id", + "entityType": "columns", + "table": "ticket_participants" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "role", + "entityType": "columns", + "table": "ticket_participants" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "reason", + "entityType": "columns", + "table": "ticket_participants" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "ticket_participants" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": true, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "anonymous_id", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "status", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "channel_id", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "close_reason", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "private_reason", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "opened_at", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "closed_at", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "opened_by", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "open_reason", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "subject", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "claimed_by", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "claimed_at", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "thanked_at", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "warned_at", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "last_message_at", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "has_moderator_message", + "entityType": "columns", + "table": "tickets" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "has_author_message", + "entityType": "columns", + "table": "tickets" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "actors", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_sessions_user_id_actors_id_fk", + "entityType": "fks", + "table": "sessions" + }, + { + "columns": [ + "message_id" + ], + "tableTo": "ticket_messages", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_ticket_attachments_message_id_ticket_messages_id_fk", + "entityType": "fks", + "table": "ticket_attachments" + }, + { + "columns": [ + "ticket_id" + ], + "tableTo": "tickets", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_ticket_attachments_ticket_id_tickets_id_fk", + "entityType": "fks", + "table": "ticket_attachments" + }, + { + "columns": [ + "actor_id" + ], + "tableTo": "actors", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_ticket_attachments_actor_id_actors_id_fk", + "entityType": "fks", + "table": "ticket_attachments" + }, + { + "columns": [ + "ticket_id" + ], + "tableTo": "tickets", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_ticket_messages_ticket_id_tickets_id_fk", + "entityType": "fks", + "table": "ticket_messages" + }, + { + "columns": [ + "actor_id" + ], + "tableTo": "actors", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_ticket_messages_actor_id_actors_id_fk", + "entityType": "fks", + "table": "ticket_messages" + }, + { + "columns": [ + "ticket_id" + ], + "tableTo": "tickets", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_ticket_participants_ticket_id_tickets_id_fk", + "entityType": "fks", + "table": "ticket_participants" + }, + { + "columns": [ + "actor_id" + ], + "tableTo": "actors", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_ticket_participants_actor_id_actors_id_fk", + "entityType": "fks", + "table": "ticket_participants" + }, + { + "columns": [ + "opened_by" + ], + "tableTo": "actors", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_tickets_opened_by_actors_id_fk", + "entityType": "fks", + "table": "tickets" + }, + { + "columns": [ + "subject" + ], + "tableTo": "actors", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_tickets_subject_actors_id_fk", + "entityType": "fks", + "table": "tickets" + }, + { + "columns": [ + "claimed_by" + ], + "tableTo": "actors", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_tickets_claimed_by_actors_id_fk", + "entityType": "fks", + "table": "tickets" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "actors_pk", + "table": "actors", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "sessions_pk", + "table": "sessions", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "ticket_attachments_pk", + "table": "ticket_attachments", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "ticket_messages_pk", + "table": "ticket_messages", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "ticket_participants_pk", + "table": "ticket_participants", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "tickets_pk", + "table": "tickets", + "entityType": "pks" + }, + { + "columns": [ + { + "value": "ticket_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "ticket_attachments_ticket_idx", + "entityType": "indexes", + "table": "ticket_attachments" + }, + { + "columns": [ + { + "value": "actor_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "ticket_attachments_actor_idx", + "entityType": "indexes", + "table": "ticket_attachments" + }, + { + "columns": [ + { + "value": "public_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "ticket_attachments_public_id_idx", + "entityType": "indexes", + "table": "ticket_attachments" + }, + { + "columns": [ + { + "value": "ticket_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "ticket_messages_ticket_idx", + "entityType": "indexes", + "table": "ticket_messages" + }, + { + "columns": [ + { + "value": "actor_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "ticket_messages_actor_idx", + "entityType": "indexes", + "table": "ticket_messages" + }, + { + "columns": [ + { + "value": "public_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "ticket_messages_public_id_idx", + "entityType": "indexes", + "table": "ticket_messages" + }, + { + "columns": [ + { + "value": "ticket_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "ticket_participants_ticket_idx", + "entityType": "indexes", + "table": "ticket_participants" + }, + { + "columns": [ + { + "value": "actor_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "ticket_participants_actor_idx", + "entityType": "indexes", + "table": "ticket_participants" + }, + { + "columns": [ + { + "value": "role", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "ticket_participants_role_idx", + "entityType": "indexes", + "table": "ticket_participants" + }, + { + "columns": [ + "discord_id" + ], + "nameExplicit": false, + "name": "actors_discord_id_unique", + "entityType": "uniques", + "table": "actors" + } + ], + "renames": [ + "tickets.private_notes->tickets.private_reason" + ] +}
M pkgs/db/src/schemas/relations.tspkgs/db/src/schemas/relations.ts

@@ -1,12 +1,12 @@

import { defineRelations } from "drizzle-orm"; import { actors, sessions } from "./actors"; -import { ticket, ticketParticipants, ticketMessages, ticketAttachments } from "./tickets"; +import { tickets, ticketParticipants, ticketMessages, ticketAttachments } from "./tickets"; export const schemaRelations = defineRelations( { actors, sessions, - ticket, + tickets, ticketParticipants, ticketMessages, ticketAttachments,

@@ -18,19 +18,19 @@ from: r.actors.id,

to: r.sessions.userId, }), - openedTickets: r.many.ticket({ + openedTickets: r.many.tickets({ from: r.actors.id, - to: r.ticket.openedBy, + to: r.tickets.openedBy, alias: "ticket_opened_by", }), - subjectTickets: r.many.ticket({ + subjectTickets: r.many.tickets({ from: r.actors.id, - to: r.ticket.subject, + to: r.tickets.subject, alias: "ticket_subject", }), - claimedTickets: r.many.ticket({ + claimedTickets: r.many.tickets({ from: r.actors.id, - to: r.ticket.claimedBy, + to: r.tickets.claimedBy, alias: "ticket_claimed_by", }), ticketParticipants: r.many.ticketParticipants({

@@ -54,40 +54,40 @@ to: r.actors.id,

}), }, - ticket: { + tickets: { opener: r.one.actors({ - from: r.ticket.openedBy, + from: r.tickets.openedBy, to: r.actors.id, alias: "ticket_opened_by", }), subjectActor: r.one.actors({ - from: r.ticket.subject, + from: r.tickets.subject, to: r.actors.id, alias: "ticket_subject", }), claimedByActor: r.one.actors({ - from: r.ticket.claimedBy, + from: r.tickets.claimedBy, to: r.actors.id, alias: "ticket_claimed_by", }), participants: r.many.ticketParticipants({ - from: r.ticket.id, + from: r.tickets.id, to: r.ticketParticipants.ticketId, }), messages: r.many.ticketMessages({ - from: r.ticket.id, + from: r.tickets.id, to: r.ticketMessages.ticketId, }), attachments: r.many.ticketAttachments({ - from: r.ticket.id, + from: r.tickets.id, to: r.ticketAttachments.ticketId, }), }, ticketParticipants: { - ticket: r.one.ticket({ + tickets: r.one.tickets({ from: r.ticketParticipants.ticketId, - to: r.ticket.id, + to: r.tickets.id, }), actor: r.one.actors({ from: r.ticketParticipants.actorId,

@@ -96,9 +96,9 @@ }),

}, ticketMessages: { - ticket: r.one.ticket({ + tickets: r.one.tickets({ from: r.ticketMessages.ticketId, - to: r.ticket.id, + to: r.tickets.id, }), actor: r.one.actors({ from: r.ticketMessages.actorId,

@@ -111,9 +111,9 @@ }),

}, ticketAttachments: { - ticket: r.one.ticket({ + tickets: r.one.tickets({ from: r.ticketAttachments.ticketId, - to: r.ticket.id, + to: r.tickets.id, }), actor: r.one.actors({ from: r.ticketAttachments.actorId,
M pkgs/db/src/schemas/tickets.tspkgs/db/src/schemas/tickets.ts

@@ -1,15 +1,15 @@

import * as s from "drizzle-orm/sqlite-core"; import { actors } from "./actors"; -export const ticket = s.sqliteTable("tickets", { +export const tickets = s.sqliteTable("tickets", { id: s.integer("id").primaryKey({ autoIncrement: true }), anonymousId: s.text("anonymous_id").notNull(), status: s.text("status").notNull(), - channelId: s.text("channel_id").notNull(), + channelId: s.text("channel_id"), closeReason: s.text("close_reason"), - privateNotes: s.text("private_notes"), + privateReason: s.text("private_reason"), openedAt: s.integer("opened_at", { mode: "timestamp" }).notNull(), closedAt: s.integer("closed_at", { mode: "timestamp" }),

@@ -45,7 +45,7 @@ id: s.integer("id").primaryKey({ autoIncrement: true }),

ticketId: s .integer("ticket_id") .notNull() - .references(() => ticket.id, { onDelete: "cascade" }), + .references(() => tickets.id, { onDelete: "cascade" }), actorId: s .integer("actor_id") .notNull()

@@ -73,7 +73,7 @@

ticketId: s .integer("ticket_id") .notNull() - .references(() => ticket.id, { onDelete: "cascade" }), + .references(() => tickets.id, { onDelete: "cascade" }), actorId: s .integer("actor_id") .notNull()

@@ -102,7 +102,7 @@ messageId: s.integer("message_id").references(() => ticketMessages.id, { onDelete: "cascade" }),

ticketId: s .integer("ticket_id") .notNull() - .references(() => ticket.id, { onDelete: "cascade" }), + .references(() => tickets.id, { onDelete: "cascade" }), actorId: s .integer("actor_id") .notNull()