Skip to content

Add baseline-schema-file support to main.ts and rebuild #5

Add baseline-schema-file support to main.ts and rebuild

Add baseline-schema-file support to main.ts and rebuild #5

Workflow file for this run

name: SQLDef Preview Example
on:
pull_request:
push:
branches:
- example
jobs:
postgresql-preview:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: testdb
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Preview PostgreSQL schema changes
uses: ./
with:
command: psqldef
version: v3.0.0
baseline-schema-file: examples/psqldef-current.sql
schema-file: examples/psqldef-desired.sql
pg-user: postgres
pg-password: postgres
pg-host: localhost
pg-port: 5432
pg-database: testdb
mysql-preview:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: testdb
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
ports:
- 3306:3306
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Preview MySQL schema changes
uses: ./
with:
command: mysqldef
version: v3.0.0
baseline-schema-file: examples/mysqldef-current.sql
schema-file: examples/mysqldef-desired.sql
mysql-user: root
mysql-password: root
mysql-host: localhost
mysql-port: 3306
mysql-database: testdb
sqlite-preview:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Preview SQLite schema changes
uses: ./
with:
command: sqlite3def
version: v3.0.0
baseline-schema-file: examples/sqlite3def-current.sql
schema-file: examples/sqlite3def-desired.sql
sqlite-database: test.db
mssql-preview:
runs-on: ubuntu-latest
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: YourStrong@Passw0rd
MSSQL_PID: Developer
options: >-
--health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'YourStrong@Passw0rd' -Q 'SELECT 1'"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 1433:1433
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Wait for SQL Server
run: |
for i in {1..30}; do
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'YourStrong@Passw0rd' -Q 'SELECT 1' && break
echo "Waiting for SQL Server..."
sleep 2
done
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'YourStrong@Passw0rd' -Q "CREATE DATABASE testdb"
- name: Preview MSSQL schema changes
uses: ./
with:
command: mssqldef
version: v3.0.0
baseline-schema-file: examples/mssqldef-current.sql
schema-file: examples/mssqldef-desired.sql
mssql-user: sa
mssql-password: YourStrong@Passw0rd
mssql-host: localhost
mssql-port: 1433
mssql-database: testdb