mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-13 02:25:06 +08:00
feat: 将数据库工具迁移至sql/tools目录
This commit is contained in:
71
sql/tools/docker-compose.yaml
Normal file
71
sql/tools/docker-compose.yaml
Normal file
@ -0,0 +1,71 @@
|
||||
name: ruoyi-vue-pro
|
||||
|
||||
volumes:
|
||||
mysql: { }
|
||||
postgres: { }
|
||||
sqlserver: { }
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.0.33
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
MYSQL_ROOT_PASSWORD: 123456
|
||||
MYSQL_DATABASE: ruoyi-vue-pro
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- mysql:/var/lib/mysql/
|
||||
# 注入初始化脚本
|
||||
- ./mysql/ruoyi-vue-pro.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
command:
|
||||
--default-authentication-plugin=mysql_native_password
|
||||
--character-set-server=utf8mb4
|
||||
--collation-server=utf8mb4_general_ci
|
||||
--explicit_defaults_for_timestamp=true
|
||||
--lower_case_table_names=1
|
||||
|
||||
postgres:
|
||||
image: postgres:14.2
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: root
|
||||
POSTGRES_PASSWORD: 123456
|
||||
POSTGRES_DB: ruoyi-vue-pro
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
# 注入初始化脚本
|
||||
- ../postgresql/quartz.sql:/docker-entrypoint-initdb.d/quartz.sql:ro
|
||||
- ../postgresql/ruoyi-vue-pro.sql:/docker-entrypoint-initdb.d/ruoyi-vue-pro.sql:ro
|
||||
|
||||
oracle:
|
||||
image: gvenzl/oracle-xe:18-slim-faststart
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
## 登录信息 SID: XE user: system password: oracle
|
||||
ORACLE_PASSWORD: oracle
|
||||
ports:
|
||||
- "1521:1521"
|
||||
volumes:
|
||||
- ../oracle/ruoyi-vue-pro.sql:/tmp/schema.sql:ro
|
||||
# 创建app用户: ROOT/123456@//localhost/XEPDB1
|
||||
- ./oracle/1_create_user.sql:/docker-entrypoint-initdb.d/1_create_user.sql:ro
|
||||
- ./oracle/2_create_schema.sh:/docker-entrypoint-initdb.d/2_create_schema.sh:ro
|
||||
|
||||
sqlserver:
|
||||
image: mcr.microsoft.com/mssql/server:2017-latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
ACCEPT_EULA: "Y"
|
||||
SA_PASSWORD: "Yudao@24"
|
||||
ports:
|
||||
- "1433:1433"
|
||||
volumes:
|
||||
- sqlserver:/var/opt/mssql
|
||||
- ../sqlserver/ruoyi-vue-pro.sql:/tmp/schema.sql:ro
|
||||
# docker compose exec sqlserver bash /tmp/create_schema.sh
|
||||
- ./sqlserver/create_schema.sh:/tmp/create_schema.sh:ro
|
3
sql/tools/oracle/1_create_user.sql
Normal file
3
sql/tools/oracle/1_create_user.sql
Normal file
@ -0,0 +1,3 @@
|
||||
ALTER SESSION SET CONTAINER=XEPDB1;
|
||||
CREATE USER ROOT IDENTIFIED BY 123456 QUOTA UNLIMITED ON USERS;
|
||||
GRANT CONNECT, RESOURCE TO ROOT;
|
1
sql/tools/oracle/2_create_schema.sh
Executable file
1
sql/tools/oracle/2_create_schema.sh
Executable file
@ -0,0 +1 @@
|
||||
sqlplus -s ROOT/123456@//localhost/XEPDB1 @/tmp/schema.sql
|
5
sql/tools/sqlserver/create_schema.sh
Executable file
5
sql/tools/sqlserver/create_schema.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Yudao@24' -Q "CREATE DATABASE [ruoyi-vue-pro];
|
||||
GO"
|
||||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Yudao@24' -d 'ruoyi-vue-pro' -i /tmp/schema.sql
|
Reference in New Issue
Block a user