Browse Source

fix: sqlserver DROP TABLE 使用GO替代分号

dhb52 10 months ago
parent
commit
0288309e3b
2 changed files with 99 additions and 51 deletions
  1. 97 49
      sql/sqlserver/ruoyi-vue-pro.sql
  2. 2 2
      sql/tools/convertor.py

+ 97 - 49
sql/sqlserver/ruoyi-vue-pro.sql

@@ -6,6 +6,7 @@
  Target Server Type    : Microsoft SQL Server
 
  Date: 2024-05-08 00:22:09
+ Date: 2024-05-10 22:07:48
 */
 
 
@@ -14,7 +15,6 @@
 -- ----------------------------
 DROP TABLE IF EXISTS dual
 GO
-
 CREATE TABLE dual
 (
     id int
@@ -38,7 +38,8 @@ GO
 -- ----------------------------
 -- Table structure for infra_api_access_log
 -- ----------------------------
-DROP TABLE IF EXISTS infra_api_access_log;
+DROP TABLE IF EXISTS infra_api_access_log
+GO
 CREATE TABLE infra_api_access_log
 (
     id               bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -256,7 +257,8 @@ GO
 -- ----------------------------
 -- Table structure for infra_api_error_log
 -- ----------------------------
-DROP TABLE IF EXISTS infra_api_error_log;
+DROP TABLE IF EXISTS infra_api_error_log
+GO
 CREATE TABLE infra_api_error_log
 (
     id                           bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -515,7 +517,8 @@ GO
 -- ----------------------------
 -- Table structure for infra_codegen_column
 -- ----------------------------
-DROP TABLE IF EXISTS infra_codegen_column;
+DROP TABLE IF EXISTS infra_codegen_column
+GO
 CREATE TABLE infra_codegen_column
 (
     id                       bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -714,7 +717,8 @@ GO
 -- ----------------------------
 -- Table structure for infra_codegen_table
 -- ----------------------------
-DROP TABLE IF EXISTS infra_codegen_table;
+DROP TABLE IF EXISTS infra_codegen_table
+GO
 CREATE TABLE infra_codegen_table
 (
     id                    bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -921,7 +925,8 @@ GO
 -- ----------------------------
 -- Table structure for infra_config
 -- ----------------------------
-DROP TABLE IF EXISTS infra_config;
+DROP TABLE IF EXISTS infra_config
+GO
 CREATE TABLE infra_config
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -1068,7 +1073,8 @@ GO
 -- ----------------------------
 -- Table structure for infra_data_source_config
 -- ----------------------------
-DROP TABLE IF EXISTS infra_data_source_config;
+DROP TABLE IF EXISTS infra_data_source_config
+GO
 CREATE TABLE infra_data_source_config
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -1163,7 +1169,8 @@ GO
 -- ----------------------------
 -- Table structure for infra_file
 -- ----------------------------
-DROP TABLE IF EXISTS infra_file;
+DROP TABLE IF EXISTS infra_file
+GO
 CREATE TABLE infra_file
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -1274,7 +1281,8 @@ GO
 -- ----------------------------
 -- Table structure for infra_file_config
 -- ----------------------------
-DROP TABLE IF EXISTS infra_file_config;
+DROP TABLE IF EXISTS infra_file_config
+GO
 CREATE TABLE infra_file_config
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -1395,7 +1403,8 @@ GO
 -- ----------------------------
 -- Table structure for infra_file_content
 -- ----------------------------
-DROP TABLE IF EXISTS infra_file_content;
+DROP TABLE IF EXISTS infra_file_content
+GO
 CREATE TABLE infra_file_content
 (
     id          bigint                                 NOT NULL PRIMARY KEY IDENTITY,
@@ -1482,7 +1491,8 @@ GO
 -- ----------------------------
 -- Table structure for infra_job
 -- ----------------------------
-DROP TABLE IF EXISTS infra_job;
+DROP TABLE IF EXISTS infra_job
+GO
 CREATE TABLE infra_job
 (
     id              bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -1645,7 +1655,8 @@ GO
 -- ----------------------------
 -- Table structure for infra_job_log
 -- ----------------------------
-DROP TABLE IF EXISTS infra_job_log;
+DROP TABLE IF EXISTS infra_job_log
+GO
 CREATE TABLE infra_job_log
 (
     id            bigint                                   NOT NULL PRIMARY KEY IDENTITY,
@@ -1780,7 +1791,8 @@ GO
 -- ----------------------------
 -- Table structure for system_dept
 -- ----------------------------
-DROP TABLE IF EXISTS system_dept;
+DROP TABLE IF EXISTS system_dept
+GO
 CREATE TABLE system_dept
 (
     id             bigint                                 NOT NULL PRIMARY KEY IDENTITY,
@@ -1949,7 +1961,8 @@ GO
 -- ----------------------------
 -- Table structure for system_dict_data
 -- ----------------------------
-DROP TABLE IF EXISTS system_dict_data;
+DROP TABLE IF EXISTS system_dict_data
+GO
 CREATE TABLE system_dict_data
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -2820,7 +2833,8 @@ GO
 -- ----------------------------
 -- Table structure for system_dict_type
 -- ----------------------------
-DROP TABLE IF EXISTS system_dict_type;
+DROP TABLE IF EXISTS system_dict_type
+GO
 CREATE TABLE system_dict_type
 (
     id           bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -3103,7 +3117,8 @@ GO
 -- ----------------------------
 -- Table structure for system_login_log
 -- ----------------------------
-DROP TABLE IF EXISTS system_login_log;
+DROP TABLE IF EXISTS system_login_log
+GO
 CREATE TABLE system_login_log
 (
     id          bigint                                 NOT NULL PRIMARY KEY IDENTITY,
@@ -3238,7 +3253,8 @@ GO
 -- ----------------------------
 -- Table structure for system_mail_account
 -- ----------------------------
-DROP TABLE IF EXISTS system_mail_account;
+DROP TABLE IF EXISTS system_mail_account
+GO
 CREATE TABLE system_mail_account
 (
     id              bigint                                 NOT NULL PRIMARY KEY IDENTITY,
@@ -3379,7 +3395,8 @@ GO
 -- ----------------------------
 -- Table structure for system_mail_log
 -- ----------------------------
-DROP TABLE IF EXISTS system_mail_log;
+DROP TABLE IF EXISTS system_mail_log
+GO
 CREATE TABLE system_mail_log
 (
     id                bigint                                   NOT NULL PRIMARY KEY IDENTITY,
@@ -3562,7 +3579,8 @@ GO
 -- ----------------------------
 -- Table structure for system_mail_template
 -- ----------------------------
-DROP TABLE IF EXISTS system_mail_template;
+DROP TABLE IF EXISTS system_mail_template
+GO
 CREATE TABLE system_mail_template
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -3717,7 +3735,8 @@ GO
 -- ----------------------------
 -- Table structure for system_menu
 -- ----------------------------
-DROP TABLE IF EXISTS system_menu;
+DROP TABLE IF EXISTS system_menu
+GO
 CREATE TABLE system_menu
 (
     id             bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -5478,7 +5497,8 @@ GO
 -- ----------------------------
 -- Table structure for system_notice
 -- ----------------------------
-DROP TABLE IF EXISTS system_notice;
+DROP TABLE IF EXISTS system_notice
+GO
 CREATE TABLE system_notice
 (
     id          bigint                                 NOT NULL PRIMARY KEY IDENTITY,
@@ -5601,7 +5621,8 @@ GO
 -- ----------------------------
 -- Table structure for system_notify_message
 -- ----------------------------
-DROP TABLE IF EXISTS system_notify_message;
+DROP TABLE IF EXISTS system_notify_message
+GO
 CREATE TABLE system_notify_message
 (
     id                bigint                                 NOT NULL PRIMARY KEY IDENTITY,
@@ -5784,7 +5805,8 @@ GO
 -- ----------------------------
 -- Table structure for system_notify_template
 -- ----------------------------
-DROP TABLE IF EXISTS system_notify_template;
+DROP TABLE IF EXISTS system_notify_template
+GO
 CREATE TABLE system_notify_template
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -5911,7 +5933,8 @@ GO
 -- ----------------------------
 -- Table structure for system_oauth2_access_token
 -- ----------------------------
-DROP TABLE IF EXISTS system_oauth2_access_token;
+DROP TABLE IF EXISTS system_oauth2_access_token
+GO
 CREATE TABLE system_oauth2_access_token
 (
     id            bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -6051,7 +6074,8 @@ GO
 -- ----------------------------
 -- Table structure for system_oauth2_approve
 -- ----------------------------
-DROP TABLE IF EXISTS system_oauth2_approve;
+DROP TABLE IF EXISTS system_oauth2_approve
+GO
 CREATE TABLE system_oauth2_approve
 (
     id           bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -6170,7 +6194,8 @@ GO
 -- ----------------------------
 -- Table structure for system_oauth2_client
 -- ----------------------------
-DROP TABLE IF EXISTS system_oauth2_client;
+DROP TABLE IF EXISTS system_oauth2_client
+GO
 CREATE TABLE system_oauth2_client
 (
     id                             bigint                                   NOT NULL PRIMARY KEY IDENTITY,
@@ -6375,7 +6400,8 @@ GO
 -- ----------------------------
 -- Table structure for system_oauth2_code
 -- ----------------------------
-DROP TABLE IF EXISTS system_oauth2_code;
+DROP TABLE IF EXISTS system_oauth2_code
+GO
 CREATE TABLE system_oauth2_code
 (
     id           bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -6510,7 +6536,8 @@ GO
 -- ----------------------------
 -- Table structure for system_oauth2_refresh_token
 -- ----------------------------
-DROP TABLE IF EXISTS system_oauth2_refresh_token;
+DROP TABLE IF EXISTS system_oauth2_refresh_token
+GO
 CREATE TABLE system_oauth2_refresh_token
 (
     id            bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -6629,7 +6656,8 @@ GO
 -- ----------------------------
 -- Table structure for system_operate_log
 -- ----------------------------
-DROP TABLE IF EXISTS system_operate_log;
+DROP TABLE IF EXISTS system_operate_log
+GO
 CREATE TABLE system_operate_log
 (
     id             bigint                                   NOT NULL PRIMARY KEY IDENTITY,
@@ -6796,7 +6824,8 @@ GO
 -- ----------------------------
 -- Table structure for system_post
 -- ----------------------------
-DROP TABLE IF EXISTS system_post;
+DROP TABLE IF EXISTS system_post
+GO
 CREATE TABLE system_post
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -6929,7 +6958,8 @@ GO
 -- ----------------------------
 -- Table structure for system_role
 -- ----------------------------
-DROP TABLE IF EXISTS system_role;
+DROP TABLE IF EXISTS system_role
+GO
 CREATE TABLE system_role
 (
     id                  bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -7090,7 +7120,8 @@ GO
 -- ----------------------------
 -- Table structure for system_role_menu
 -- ----------------------------
-DROP TABLE IF EXISTS system_role_menu;
+DROP TABLE IF EXISTS system_role_menu
+GO
 CREATE TABLE system_role_menu
 (
     id          bigint                                 NOT NULL PRIMARY KEY IDENTITY,
@@ -8837,7 +8868,8 @@ GO
 -- ----------------------------
 -- Table structure for system_sms_channel
 -- ----------------------------
-DROP TABLE IF EXISTS system_sms_channel;
+DROP TABLE IF EXISTS system_sms_channel
+GO
 CREATE TABLE system_sms_channel
 (
     id           bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -8976,7 +9008,8 @@ GO
 -- ----------------------------
 -- Table structure for system_sms_code
 -- ----------------------------
-DROP TABLE IF EXISTS system_sms_code;
+DROP TABLE IF EXISTS system_sms_code
+GO
 CREATE TABLE system_sms_code
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -9114,7 +9147,8 @@ GO
 -- ----------------------------
 -- Table structure for system_sms_log
 -- ----------------------------
-DROP TABLE IF EXISTS system_sms_log;
+DROP TABLE IF EXISTS system_sms_log
+GO
 CREATE TABLE system_sms_log
 (
     id               bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -9345,7 +9379,8 @@ GO
 -- ----------------------------
 -- Table structure for system_sms_template
 -- ----------------------------
-DROP TABLE IF EXISTS system_sms_template;
+DROP TABLE IF EXISTS system_sms_template
+GO
 CREATE TABLE system_sms_template
 (
     id              bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -9526,7 +9561,8 @@ GO
 -- ----------------------------
 -- Table structure for system_social_client
 -- ----------------------------
-DROP TABLE IF EXISTS system_social_client;
+DROP TABLE IF EXISTS system_social_client
+GO
 CREATE TABLE system_social_client
 (
     id            bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -9675,7 +9711,8 @@ GO
 -- ----------------------------
 -- Table structure for system_social_user
 -- ----------------------------
-DROP TABLE IF EXISTS system_social_user;
+DROP TABLE IF EXISTS system_social_user
+GO
 CREATE TABLE system_social_user
 (
     id             bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -9818,7 +9855,8 @@ GO
 -- ----------------------------
 -- Table structure for system_social_user_bind
 -- ----------------------------
-DROP TABLE IF EXISTS system_social_user_bind;
+DROP TABLE IF EXISTS system_social_user_bind
+GO
 CREATE TABLE system_social_user_bind
 (
     id             bigint                                 NOT NULL PRIMARY KEY IDENTITY,
@@ -9921,7 +9959,8 @@ GO
 -- ----------------------------
 -- Table structure for system_tenant
 -- ----------------------------
-DROP TABLE IF EXISTS system_tenant;
+DROP TABLE IF EXISTS system_tenant
+GO
 CREATE TABLE system_tenant
 (
     id              bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -10076,7 +10115,8 @@ GO
 -- ----------------------------
 -- Table structure for system_tenant_package
 -- ----------------------------
-DROP TABLE IF EXISTS system_tenant_package;
+DROP TABLE IF EXISTS system_tenant_package
+GO
 CREATE TABLE system_tenant_package
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -10187,7 +10227,8 @@ GO
 -- ----------------------------
 -- Table structure for system_user_post
 -- ----------------------------
-DROP TABLE IF EXISTS system_user_post;
+DROP TABLE IF EXISTS system_user_post
+GO
 CREATE TABLE system_user_post
 (
     id          bigint                                 NOT NULL PRIMARY KEY IDENTITY,
@@ -10304,7 +10345,8 @@ GO
 -- ----------------------------
 -- Table structure for system_user_role
 -- ----------------------------
-DROP TABLE IF EXISTS system_user_role;
+DROP TABLE IF EXISTS system_user_role
+GO
 CREATE TABLE system_user_role
 (
     id          bigint                                 NOT NULL PRIMARY KEY IDENTITY,
@@ -10435,7 +10477,8 @@ GO
 -- ----------------------------
 -- Table structure for system_users
 -- ----------------------------
-DROP TABLE IF EXISTS system_users;
+DROP TABLE IF EXISTS system_users
+GO
 CREATE TABLE system_users
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -10656,7 +10699,8 @@ GO
 -- ----------------------------
 -- Table structure for yudao_demo01_contact
 -- ----------------------------
-DROP TABLE IF EXISTS yudao_demo01_contact;
+DROP TABLE IF EXISTS yudao_demo01_contact
+GO
 CREATE TABLE yudao_demo01_contact
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -10783,7 +10827,8 @@ GO
 -- ----------------------------
 -- Table structure for yudao_demo02_category
 -- ----------------------------
-DROP TABLE IF EXISTS yudao_demo02_category;
+DROP TABLE IF EXISTS yudao_demo02_category
+GO
 CREATE TABLE yudao_demo02_category
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -10896,7 +10941,8 @@ GO
 -- ----------------------------
 -- Table structure for yudao_demo03_course
 -- ----------------------------
-DROP TABLE IF EXISTS yudao_demo03_course;
+DROP TABLE IF EXISTS yudao_demo03_course
+GO
 CREATE TABLE yudao_demo03_course
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -11025,7 +11071,8 @@ GO
 -- ----------------------------
 -- Table structure for yudao_demo03_grade
 -- ----------------------------
-DROP TABLE IF EXISTS yudao_demo03_grade;
+DROP TABLE IF EXISTS yudao_demo03_grade
+GO
 CREATE TABLE yudao_demo03_grade
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,
@@ -11140,7 +11187,8 @@ GO
 -- ----------------------------
 -- Table structure for yudao_demo03_student
 -- ----------------------------
-DROP TABLE IF EXISTS yudao_demo03_student;
+DROP TABLE IF EXISTS yudao_demo03_student
+GO
 CREATE TABLE yudao_demo03_student
 (
     id          bigint                                  NOT NULL PRIMARY KEY IDENTITY,

+ 2 - 2
sql/tools/convertor.py

@@ -562,7 +562,8 @@ class SQLServerConvertor(Convertor):
         script = f"""-- ----------------------------
 -- Table structure for {table_name}
 -- ----------------------------
-DROP TABLE IF EXISTS {table_name};
+DROP TABLE IF EXISTS {table_name}
+GO
 CREATE TABLE {table_name} (
     {filed_def_list}
 )
@@ -642,7 +643,6 @@ GO
     def gen_dual(self) -> str:
         return """DROP TABLE IF EXISTS dual
 GO
-
 CREATE TABLE dual
 (
   id int