
CREATE TABLE base_ai_chat(
                             f_id nvarchar(50) NOT NULL,
                             f_full_name nvarchar(200),
                             f_enabled_mark int,
                             f_sort_code bigint,
                             f_creator_time datetime,
                             f_creator_user_id nvarchar(50),
                             f_last_modify_time datetime,
                             f_last_modify_user_id nvarchar(50),
                             f_delete_time datetime,
                             f_delete_user_id nvarchar(50),
                             f_delete_mark int,
                             f_tenant_id nvarchar(50) NOT NULL DEFAULT '0'

    , PRIMARY KEY (f_id,f_tenant_id)
);
EXEC sp_addextendedproperty 'MS_Description',N'ai会话列表','SCHEMA',N'dbo','TABLE',N'base_ai_chat';
EXEC sp_addextendedproperty 'MS_Description',N'自然主键','SCHEMA',N'dbo','TABLE',N'base_ai_chat','COLUMN',N'f_id';
EXEC sp_addextendedproperty 'MS_Description',N'会话标题','SCHEMA',N'dbo','TABLE',N'base_ai_chat','COLUMN',N'f_full_name';
EXEC sp_addextendedproperty 'MS_Description',N'有效标志','SCHEMA',N'dbo','TABLE',N'base_ai_chat','COLUMN',N'f_enabled_mark';
EXEC sp_addextendedproperty 'MS_Description',N'排序','SCHEMA',N'dbo','TABLE',N'base_ai_chat','COLUMN',N'f_sort_code';
EXEC sp_addextendedproperty 'MS_Description',N'创建时间','SCHEMA',N'dbo','TABLE',N'base_ai_chat','COLUMN',N'f_creator_time';
EXEC sp_addextendedproperty 'MS_Description',N'创建用户','SCHEMA',N'dbo','TABLE',N'base_ai_chat','COLUMN',N'f_creator_user_id';
EXEC sp_addextendedproperty 'MS_Description',N'修改时间','SCHEMA',N'dbo','TABLE',N'base_ai_chat','COLUMN',N'f_last_modify_time';
EXEC sp_addextendedproperty 'MS_Description',N'修改用户','SCHEMA',N'dbo','TABLE',N'base_ai_chat','COLUMN',N'f_last_modify_user_id';
EXEC sp_addextendedproperty 'MS_Description',N'删除时间','SCHEMA',N'dbo','TABLE',N'base_ai_chat','COLUMN',N'f_delete_time';
EXEC sp_addextendedproperty 'MS_Description',N'删除用户','SCHEMA',N'dbo','TABLE',N'base_ai_chat','COLUMN',N'f_delete_user_id';
EXEC sp_addextendedproperty 'MS_Description',N'删除标志','SCHEMA',N'dbo','TABLE',N'base_ai_chat','COLUMN',N'f_delete_mark';
EXEC sp_addextendedproperty 'MS_Description',N'租户id','SCHEMA',N'dbo','TABLE',N'base_ai_chat','COLUMN',N'f_tenant_id';
CREATE TABLE base_ai_history(
                                f_id nvarchar(50) NOT NULL,
                                f_chat_id nvarchar(50),
                                f_question_text nvarchar(max),
                                f_content nvarchar(max),
                                f_type int,
                                f_enabled_mark int,
                                f_sort_code bigint,
                                f_creator_time datetime,
                                f_creator_user_id nvarchar(50),
                                f_last_modify_time datetime,
                                f_last_modify_user_id nvarchar(50),
                                f_delete_time datetime,
                                f_delete_user_id nvarchar(50),
                                f_delete_mark int,
                                f_tenant_id nvarchar(50) NOT NULL DEFAULT '0'

    , PRIMARY KEY (f_id,f_tenant_id)
);
EXEC sp_addextendedproperty 'MS_Description',N'ai会话记录','SCHEMA',N'dbo','TABLE',N'base_ai_history';
EXEC sp_addextendedproperty 'MS_Description',N'自然主键','SCHEMA',N'dbo','TABLE',N'base_ai_history','COLUMN',N'f_id';
EXEC sp_addextendedproperty 'MS_Description',N'会话id','SCHEMA',N'dbo','TABLE',N'base_ai_history','COLUMN',N'f_chat_id';
EXEC sp_addextendedproperty 'MS_Description',N'问题内容','SCHEMA',N'dbo','TABLE',N'base_ai_history','COLUMN',N'f_question_text';
EXEC sp_addextendedproperty 'MS_Description',N'会话内容','SCHEMA',N'dbo','TABLE',N'base_ai_history','COLUMN',N'f_content';
EXEC sp_addextendedproperty 'MS_Description',N'类型（0-ai，1-用户）','SCHEMA',N'dbo','TABLE',N'base_ai_history','COLUMN',N'f_type';
EXEC sp_addextendedproperty 'MS_Description',N'有效标志','SCHEMA',N'dbo','TABLE',N'base_ai_history','COLUMN',N'f_enabled_mark';
EXEC sp_addextendedproperty 'MS_Description',N'排序','SCHEMA',N'dbo','TABLE',N'base_ai_history','COLUMN',N'f_sort_code';
EXEC sp_addextendedproperty 'MS_Description',N'创建时间','SCHEMA',N'dbo','TABLE',N'base_ai_history','COLUMN',N'f_creator_time';
EXEC sp_addextendedproperty 'MS_Description',N'创建用户','SCHEMA',N'dbo','TABLE',N'base_ai_history','COLUMN',N'f_creator_user_id';
EXEC sp_addextendedproperty 'MS_Description',N'修改时间','SCHEMA',N'dbo','TABLE',N'base_ai_history','COLUMN',N'f_last_modify_time';
EXEC sp_addextendedproperty 'MS_Description',N'修改用户','SCHEMA',N'dbo','TABLE',N'base_ai_history','COLUMN',N'f_last_modify_user_id';
EXEC sp_addextendedproperty 'MS_Description',N'删除时间','SCHEMA',N'dbo','TABLE',N'base_ai_history','COLUMN',N'f_delete_time';
EXEC sp_addextendedproperty 'MS_Description',N'删除用户','SCHEMA',N'dbo','TABLE',N'base_ai_history','COLUMN',N'f_delete_user_id';
EXEC sp_addextendedproperty 'MS_Description',N'删除标志','SCHEMA',N'dbo','TABLE',N'base_ai_history','COLUMN',N'f_delete_mark';
EXEC sp_addextendedproperty 'MS_Description',N'租户id','SCHEMA',N'dbo','TABLE',N'base_ai_history','COLUMN',N'f_tenant_id';
