From f38d059212703209846b9afdb3d0b58b82e241fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B0=8F=E4=BA=91?= Date: Tue, 24 Feb 2026 17:14:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0flyway=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E7=89=88=E6=9C=AC=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 12 ++++++++++++ src/main/resources/bootstrap.yml | 6 +++++- .../resources/db/migration/V1__Initial_setup.sql | 10 ++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/db/migration/V1__Initial_setup.sql diff --git a/pom.xml b/pom.xml index f80f218..41507a7 100644 --- a/pom.xml +++ b/pom.xml @@ -71,6 +71,18 @@ ruoyi-common-swagger + + + org.flywaydb + flyway-core + + + + + org.flywaydb + flyway-mysql + + diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml index 5b92504..eb78f10 100644 --- a/src/main/resources/bootstrap.yml +++ b/src/main/resources/bootstrap.yml @@ -3,13 +3,17 @@ server: port: 9201 # Spring -spring: +spring: application: # 应用名称 name: ruoyi-system profiles: # 环境配置 active: prod + flyway: + table: flyway_system_schema_history # 自定义历史表名 + baseline-on-migrate: true + baseline-version: 0 cloud: nacos: discovery: diff --git a/src/main/resources/db/migration/V1__Initial_setup.sql b/src/main/resources/db/migration/V1__Initial_setup.sql new file mode 100644 index 0000000..a496326 --- /dev/null +++ b/src/main/resources/db/migration/V1__Initial_setup.sql @@ -0,0 +1,10 @@ +-- Initial setup for ruoyi-system module +-- This is a placeholder migration file +-- Add your initial database schema here + +-- Example: +-- CREATE TABLE IF NOT EXISTS example_table ( +-- id BIGINT PRIMARY KEY AUTO_INCREMENT, +-- name VARCHAR(100) NOT NULL, +-- created_time DATETIME DEFAULT CURRENT_TIMESTAMP +-- ); \ No newline at end of file