File tree Expand file tree Collapse file tree
lib/active_storage/service Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ name : Specs Rails 6.1 MSSQL
3+
4+ on :
5+ pull_request :
6+ branches : [main]
7+ push :
8+ branches : [main]
9+
10+ jobs :
11+ tests :
12+ runs-on : ubuntu-latest
13+
14+ strategy :
15+ matrix :
16+ ruby : ['3.0', '3.1', '3.2']
17+ gemfile : ['rails_6_1_mssql']
18+
19+ env :
20+ BUNDLE_GEMFILE : ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
21+ DB_TEST : mssql
22+ MSSQL_DB_HOST : 127.0.0.1
23+ MSSQL_DB_USERNAME : sa
24+ MSSQL_DB_PASSWORD : Pa%%w0rd
25+ RAILS : ' 6.1'
26+
27+ services :
28+ postgres :
29+ image : mcr.microsoft.com/mssql/server:2022-latest
30+ env :
31+ ACCEPT_EULA : ' Y'
32+ SA_PASSWORD : Pa%%w0rd
33+ ports :
34+ - 1433:1433
35+
36+ steps :
37+ - name : Install FreeTDS
38+ run : sudo apt-get install -y freetds-dev freetds-bin
39+
40+ - name : Checkout repository
41+ uses : actions/checkout@v4
42+
43+ - name : Set up Ruby
44+ uses : ruby/setup-ruby@v1
45+ with :
46+ ruby-version : ${{ matrix.ruby }}
47+ bundler-cache : true
48+
49+ - name : Database setup
50+ run : bundle exec rails db:create db:migrate
51+
52+ - name : Run tests
53+ run : bundle exec rspec --profile
Original file line number Diff line number Diff line change 1+ ---
2+ name : Specs Rails 7.0 MSSQL
3+
4+ on :
5+ pull_request :
6+ branches : [main]
7+ push :
8+ branches : [main]
9+
10+ jobs :
11+ tests :
12+ runs-on : ubuntu-latest
13+
14+ strategy :
15+ matrix :
16+ ruby : ['3.0', '3.1', '3.2']
17+ gemfile : ['rails_7_0_mssql']
18+
19+ env :
20+ BUNDLE_GEMFILE : ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
21+ DB_TEST : mssql
22+ MSSQL_DB_HOST : 127.0.0.1
23+ MSSQL_DB_USERNAME : sa
24+ MSSQL_DB_PASSWORD : Pa%%w0rd
25+ RAILS : ' 7.0'
26+
27+ services :
28+ postgres :
29+ image : mcr.microsoft.com/mssql/server:2022-latest
30+ env :
31+ ACCEPT_EULA : ' Y'
32+ SA_PASSWORD : Pa%%w0rd
33+ ports :
34+ - 1433:1433
35+
36+ steps :
37+ - name : Install FreeTDS
38+ run : sudo apt-get install -y freetds-dev freetds-bin
39+
40+ - name : Checkout repository
41+ uses : actions/checkout@v4
42+
43+ - name : Set up Ruby
44+ uses : ruby/setup-ruby@v1
45+ with :
46+ ruby-version : ${{ matrix.ruby }}
47+ bundler-cache : true
48+
49+ - name : Database setup
50+ run : bundle exec rails db:create db:migrate
51+
52+ - name : Run tests
53+ run : bundle exec rspec --profile
Original file line number Diff line number Diff line change @@ -29,3 +29,15 @@ appraise 'rails-7_1-mysql' do
2929 gem 'mysql2'
3030 gem 'rails' , '~> 7.1.0'
3131end
32+
33+ appraise 'rails-6_1-mssql' do
34+ gem 'activerecord-sqlserver-adapter' , '~> 6.1.0'
35+ gem 'rails' , '~> 6.1.0'
36+ gem 'tiny_tds'
37+ end
38+
39+ appraise 'rails-7_0-mssql' do
40+ gem 'activerecord-sqlserver-adapter' , '7.0.3.0'
41+ gem 'rails' , '~> 7.0.0'
42+ gem 'tiny_tds'
43+ end
Original file line number Diff line number Diff line change @@ -6,8 +6,13 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
66gemspec
77
88group :development , :test do
9+ if ENV [ 'DB_TEST' ] == 'mssql'
10+ gem 'activerecord-sqlserver-adapter' , '7.0.3.0'
11+ gem 'tiny_tds'
12+ end
913 gem 'mysql2' if ENV [ 'DB_TEST' ] == 'mysql'
1014 gem 'pg' if [ 'postgres' , 'postgresql' ] . include? ENV [ 'DB_TEST' ]
15+
1116 gem 'simplecov'
1217 gem 'simplecov-lcov'
1318
Original file line number Diff line number Diff line change 88[ ![ specs Postgres] ( https://github.com/blocknotes/active_storage_db/actions/workflows/specs_postgres_71.yml/badge.svg )] ( https://github.com/blocknotes/active_storage_db/actions/workflows/specs_postgres_71.yml )
99[ ![ specs MySQL] ( https://github.com/blocknotes/active_storage_db/actions/workflows/specs_mysql_71.yml/badge.svg )] ( https://github.com/blocknotes/active_storage_db/actions/workflows/specs_mysql_71.yml )
1010
11- An Active Storage service upload/download plugin that stores files in a PostgreSQL or MySQL database.
11+ An Active Storage service upload/download plugin that stores files in a PostgreSQL or MySQL database. Experimental support also for MSSQL.
1212
1313Main features:
1414- attachment data stored in a binary field (or blob);
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ FROM ruby:3.2-slim
33ARG DB_TEST
44
55RUN apt-get update
6- RUN apt-get install --no-install-recommends -y build-essential curl file git nano netcat-traditional libmariadb-dev libpq-dev openssl tzdata
6+ RUN apt-get install --no-install-recommends -y build-essential curl file freetds-dev freetds-bin git nano netcat-traditional libmariadb-dev libpq-dev openssl tzdata
77
88# App setup
99WORKDIR /usr/src/app
Original file line number Diff line number Diff line change 22version : " 3.3"
33
44x-defaults :
5+ tests_mssql : &tests_mssql
6+ environment :
7+ CI : 1
8+ DB_TEST : mssql
9+ DB_PORT : 1433
10+ MSSQL_DB_HOST : mssql
11+ MSSQL_DB_NAME : test_db
12+ MSSQL_DB_USERNAME : sa
13+ MSSQL_DB_PASSWORD : Pa%%w0rd
14+ RAILS : ' 7.0'
15+ RAILS_ENV : test
16+ command :
17+ - sh
18+ - -c
19+ - |
20+ while ! nc -z $${DB_TEST} $${DB_PORT} </dev/null
21+ do echo "Waiting for DB ($${DB_TEST})..." && sleep 5; done
22+ echo "DB is now available!"
23+ cd spec/dummy70
24+ bin/setup
25+ cd ../..
26+ bin/rspec
27+ volumes :
28+ - ..:/usr/src/app:delegated
29+ depends_on :
30+ - mssql
31+
532 tests_mysql : &tests_mysql
633 environment :
734 CI : 1
@@ -57,17 +84,24 @@ x-defaults:
5784 - postgres
5885
5986services :
60- postgres :
61- image : postgres
87+ mssql :
88+ image : mcr.microsoft.com/mssql/server:2022-latest
89+ platform : linux/amd64
6290 environment :
63- POSTGRES_PASSWORD : password
91+ ACCEPT_EULA : ' Y'
92+ SA_PASSWORD : Pa%%w0rd
6493
6594 mysql :
6695 image : mysql
6796 platform : linux/amd64
6897 environment :
6998 MYSQL_ROOT_PASSWORD : password
7099
100+ postgres :
101+ image : postgres
102+ environment :
103+ POSTGRES_PASSWORD : password
104+
71105 tests_30_mysql :
72106 << : *tests_mysql
73107 build :
@@ -84,6 +118,14 @@ services:
84118 args :
85119 DB_TEST : postgres
86120
121+ tests_32_mssql :
122+ << : *tests_mssql
123+ build :
124+ context : ..
125+ dockerfile : extra/Dockerfile_32
126+ args :
127+ DB_TEST : mssql
128+
87129 tests_32_mysql :
88130 << : *tests_mysql
89131 build :
Original file line number Diff line number Diff line change 1+ # This file was generated by Appraisal
2+
3+ source "https://rubygems.org"
4+
5+ gem "activerecord-sqlserver-adapter", "~> 6.1.0"
6+ gem "rails", "~> 6.1.0"
7+ gem "tiny_tds"
8+
9+ group :development, :test do
10+ gem "simplecov"
11+ gem "simplecov-lcov"
12+ gem "capybara"
13+ gem "rspec_junit_formatter"
14+ gem "rspec-rails"
15+ gem "selenium-webdriver"
16+ gem "brakeman"
17+ gem "fasterer"
18+ gem "rubocop"
19+ gem "rubocop-packaging"
20+ gem "rubocop-performance"
21+ gem "rubocop-rails"
22+ gem "rubocop-rspec"
23+ gem "pry-rails"
24+ end
25+
26+ gemspec path: "../"
You can’t perform that action at this time.
0 commit comments