Skip to content

Commit

Permalink
WIP: Add MSSQL support
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahgeorge committed Dec 24, 2023
1 parent 282d75d commit c71ddf6
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 6 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: false
matrix:
ruby-version: [3.2.2]
database: [mysql, postgres, sqlite]
database: [mysql, postgres, sqlite, mssql]
services:
mysql:
image: mysql:8.0.31
Expand All @@ -24,6 +24,13 @@ jobs:
POSTGRES_HOST_AUTH_METHOD: "trust"
ports:
- 55432:5432
mssql:
image: mcr.microsoft.com/azure-sql-edge:1.0.4
env:
SA_PASSWORD: yourStrongPassword123
ACCEPT_EULA: Y
ports:
- 11433:1433
env:
TARGET_DB: ${{ matrix.database }}
steps:
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ gemspec
gem "mysql2"
gem "pg"
gem "sqlite3"
gem "activerecord-sqlserver-adapter"
8 changes: 5 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ GEM
activemodel (= 7.1.0)
activesupport (= 7.1.0)
timeout (>= 0.4.0)
activerecord-sqlserver-adapter (2.3.8)
activestorage (7.1.0)
actionpack (= 7.1.0)
activejob (= 7.1.0)
Expand Down Expand Up @@ -110,7 +111,6 @@ GEM
net-smtp
marcel (1.0.2)
mini_mime (1.1.5)
mini_portile2 (2.8.1)
minitest (5.20.0)
mocha (2.1.0)
ruby2_keywords (>= 0.0.5)
Expand Down Expand Up @@ -173,8 +173,8 @@ GEM
reline (0.3.2)
io-console (~> 0.5)
ruby2_keywords (0.0.5)
sqlite3 (1.5.4)
mini_portile2 (~> 2.8.0)
sqlite3 (1.5.4-arm64-darwin)
sqlite3 (1.5.4-x86_64-linux)
thor (1.2.2)
timeout (0.4.0)
tzinfo (2.0.6)
Expand All @@ -186,10 +186,12 @@ GEM
zeitwerk (2.6.12)

PLATFORMS
arm64-darwin-21
arm64-darwin-22
x86_64-linux

DEPENDENCIES
activerecord-sqlserver-adapter
debug
mocha
mysql2
Expand Down
12 changes: 10 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,19 @@ services:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
volumes:
- db:/var/lib/mysql
ports: [ "127.0.0.1:33060:3306" ]
ports: ["127.0.0.1:33060:3306"]
postgres:
image: postgres:15.1
environment:
POSTGRES_HOST_AUTH_METHOD: "trust"
volumes:
- db:/var/lib/postgres
ports: [ "127.0.0.1:55432:5432" ]
ports: ["127.0.0.1:55432:5432"]
mssql:
image: mcr.microsoft.com/azure-sql-edge:1.0.4
environment:
SA_PASSWORD: yourStrongPassword123
ACCEPT_EULA: Y
volumes:
- db:/var/lib/mssql
ports: ["127.0.0.1:11430:1430"]
9 changes: 9 additions & 0 deletions test/dummy/config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ default: &default
port: 55432
gssencmode: disable # https://github.com/ged/ruby-pg/issues/311

<% elsif ENV["TARGET_DB"] == "mssql" %>
default: &default
adapter: sqlserver
username: sa
password: "yourStrongPassword123"
pool: 5
host: "127.0.0.1"
port: 11433

<% else %>
default: &default
adapter: mysql2
Expand Down

0 comments on commit c71ddf6

Please sign in to comment.