Ver Fonte

docs: 更新配置文件和脚本文件

ChenSiTong há 6 anos atrás
pai
commit
2ccbe4ccd7
2 ficheiros alterados com 54 adições e 116 exclusões
  1. 0 4
      src/main/resources/application-dev.yml
  2. 54 112
      src/main/resources/update.sql

+ 0 - 4
src/main/resources/application-dev.yml

@@ -4,10 +4,6 @@ spring:
     driver-class-name: com.mysql.cj.jdbc.Driver
     username: root
     password: 123456
-#    schema: classpath:update.sql
-#    schema-username: root
-#    schema-password: 123456
-#    initialization-mode: always
   jpa:
     open-in-view: true
     hibernate:

+ 54 - 112
src/main/resources/update.sql

@@ -1,122 +1,64 @@
-# alter table user
-#     modify id bigint auto_increment;
-#
-# alter table course
-#     modify id bigint auto_increment;
-# alter table course
-#     modify teacher_id bigint not null;
-#
-# alter table choose
-#     modify id bigint auto_increment;
-# alter table choose
-#     modify course_id bigint not null;
-# alter table choose
-#     modify student_id bigint not null;
-#
-# alter table slide
-#     modify id bigint auto_increment;
-# alter table slide
-#     modify course_id bigint not null;
-# alter table slide
-#     modify teacher_id bigint not null;
-# alter table slide
-#     drop teacher_name;
-# alter table slide
-#     drop course_name;
+alter table user
+    modify id bigint auto_increment;
 
-# alter table message
-#     modify id bigint auto_increment;
-# alter table message
-#     modify slide_id bigint;
-# alter table message
-#     modify to_user_id bigint not null;
+alter table course
+    modify id bigint auto_increment;
+alter table course
+    modify teacher_id bigint not null;
+alter table course
+    drop column teacher_name;
 
-# alter table reply
-#     modify id bigint auto_increment;
-# alter table reply
-#     modify teacher_id bigint not null;
-# alter table reply
-#     drop foreign key FKrd48dnp0ucmn1uyk9bdhtjm1c;
-# drop index FKrd48dnp0ucmn1uyk9bdhtjm1c on reply;
-# alter table reply
-#     modify comment_id bigint not null;
+alter table choose
+    modify id bigint auto_increment;
+alter table choose
+    modify course_id bigint not null;
+alter table choose
+    modify student_id bigint not null;
+
+alter table slide
+    modify id bigint auto_increment;
+alter table slide
+    modify course_id bigint not null;
+alter table slide
+    modify teacher_id bigint not null;
+alter table slide
+    drop teacher_name;
+alter table slide
+    drop course_name;
+
+alter table message
+    modify id bigint auto_increment;
+alter table message
+    modify slide_id bigint;
+alter table message
+    modify to_user_id bigint not null;
+
+alter table reply
+    modify id bigint auto_increment;
+alter table reply
+    modify teacher_id bigint not null;
+alter table reply
+    drop foreign key FK6w0ns67lrq1jdiwi5xvtj1vxx;
+drop index FK6w0ns67lrq1jdiwi5xvtj1vxx on reply;
+alter table reply
+    modify comment_id bigint not null;
 
 update comment
 set top_number=0
 where top_number is null;
+alter table comment
+    modify id bigint not null;
 alter table comment
     modify top_number int not null;
-# alter table comment
-#     modify user_id bigint not null;
-# alter table comment
-#     modify slide_id bigint not null;
+alter table comment
+    modify user_id bigint not null;
+alter table comment
+    modify slide_id bigint not null;
 alter table comment
     modify content text not null;
-
-# alter table comment
-#     drop user_name;
-# alter table comment
-#     drop user_type;
-delimiter //
-create procedure clear_other()
-begin
-    if exists(
-            select *
-            from information_schema.COLUMNS
-            where TABLE_NAME = 'course'
-              and COLUMN_NAME = 'teacher_name'
-              and TABLE_SCHEMA = 'helper'
-        )
-    then
-        alter table course
-            drop column teacher_name;
-    end if;
-    if exists(
-            select *
-            from information_schema.COLUMNS
-            where TABLE_NAME = 'slide'
-              and COLUMN_NAME = 'teacher_name'
-              and TABLE_SCHEMA = 'helper'
-        )
-    then
-        alter table slide
-            drop column teacher_name;
-    end if;
-    if exists(
-            select *
-            from information_schema.COLUMNS
-            where TABLE_NAME = 'slide'
-              and COLUMN_NAME = 'course_name'
-              and TABLE_SCHEMA = 'helper'
-        )
-    then
-        alter table slide
-            drop column course_name;
-    end if;
-    if exists(
-            select *
-            from information_schema.COLUMNS
-            where TABLE_NAME = 'comment'
-              and COLUMN_NAME = 'user_name'
-              and TABLE_SCHEMA = 'helper'
-        )
-    then
-        alter table comment
-            drop column user_name;
-    end if;
-    if exists(
-            select *
-            from information_schema.COLUMNS
-            where TABLE_NAME = 'comment'
-              and COLUMN_NAME = 'user_type'
-              and TABLE_SCHEMA = 'helper'
-        )
-    then
-        alter table comment
-            drop column user_type;
-    end if;
-end;
-//
-delimiter ;
-call clear_other();
-drop procedure clear_other;
+alter table comment
+    drop user_name;
+alter table comment
+    drop user_type;
+alter table comment
+    modify content text;