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;