kongdeqiang
2026-10-12 ccf1a44c001e233c158bd168dc2d0d96721af929
src/main/resources/db/h2-schema.sql
@@ -21,11 +21,26 @@
);
DROP TABLE IF EXISTS `chat`;
DROP TABLE IF EXISTS `chat_group`;
CREATE TABLE `chat_group` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL,
  `name` varchar(64) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE (`user_id`, `name`)
);
CREATE TABLE `chat` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL,
  `title` varchar(255) NOT NULL DEFAULT '新对话',
  `meta` varchar(4000) DEFAULT NULL,
  `pinned` tinyint NOT NULL DEFAULT 0,
  `pinned_at` timestamp DEFAULT NULL,
  `archived` tinyint NOT NULL DEFAULT 0,
  `archived_at` timestamp DEFAULT NULL,
  `group_id` bigint DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)