1、首先将数据库的主键修改为自增:
/**
* id值
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
2、然后删掉数据库的表以及对应的序列
3、在初始化脚本中添加如下代码:
INSERT into chat_topic(topic_text, topic_code, valid)
select "你是我的老公,用我老公的语气跟我对话", "V1001", 1
where not exists(select * from chat_topic where chat_topic.topic_code = "V1001");
INSERT into chat_topic(topic_text, topic_code, valid)
select "你是我的男朋友,用我男朋友的语气跟我对话", "V1002", 1
where not exists(select topic_code from chat_topic where topic_code = "V1002");
INSERT into chat_topic(topic_text, topic_code, valid)
select "你是我的同学,用我同学的语气跟我对话", "V1003", 1
where not exists(select topic_code from chat_topic where topic_code = "V1003");
INSERT into chat_topic(topic_text, topic_code, valid)
select "你是一个资深的法律顾问,我将咨询一些问题", "V1004", 1
where not exists(select topic_code from chat_topic where topic_code = "V1004");
INSERT into chat_topic(topic_text, topic_code, valid)
select "你是我的生活助手,我们来愉快的聊天", "V1005", 1
where not exists(select topic_code from chat_topic where topic_code = "V1005");
select setval('code_rule_config_id_seq', max(id)) from code_rule_config;
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/35019.html