File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- name : CI Mysql
1+ name : CI Mysql 5.7
22on :
33 pull_request :
44 branches :
55 - master
6+ concurrency :
7+ group : ci-mysql5-${{ github.head_ref }}
8+ cancel-in-progress : true
9+
610jobs :
711 minitest :
812 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 1+ name : CI Mysql 8.0
2+ on :
3+ pull_request :
4+ branches :
5+ - master
6+
7+ concurrency :
8+ group : ci-mysql8-${{ github.head_ref }}
9+ cancel-in-progress : true
10+
11+ jobs :
12+ minitest :
13+ runs-on : ubuntu-latest
14+ name : Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}
15+ services :
16+ mysql :
17+ image : mysql/mysql-server
18+ ports :
19+ - " 3306:3306"
20+ env :
21+ MYSQL_USER : with_advisory
22+ MYSQL_PASSWORD : with_advisory_pass
23+ MYSQL_DATABASE : with_advisory_lock_test
24+ MYSQL_ROOT_HOST : ' %'
25+ strategy :
26+ fail-fast : false
27+ matrix :
28+ ruby :
29+ - ' 3.2'
30+ - ' 3.1'
31+ - ' 3.0'
32+ - ' 2.7'
33+ - ' 3.3'
34+ - ' truffleruby'
35+ rails :
36+ - 7.1
37+ - " 7.0"
38+ - 6.1
39+ adapter :
40+ - mysql2://with_advisory:with_advisory_pass@0/with_advisory_lock_test
41+ # - trilogy://with_advisory:with_advisory_pass@0/with_advisory_lock_test Trilogy is not supported by mysql 8 with new encryption
42+ include :
43+ - ruby : jruby
44+ rails : 6.1
45+ adapter : jdbcmysql://with_advisory:with_advisory_pass@0/with_advisory_lock_test
46+ steps :
47+ - name : Checkout
48+ uses : actions/checkout@v4
49+ - name : Setup Ruby
50+ uses : ruby/setup-ruby@v1
51+ with :
52+ ruby-version : ${{ matrix.ruby }}
53+ bundler-cache : true
54+ rubygems : latest
55+ env :
56+ BUNDLE_GEMFILE : gemfiles/activerecord_${{ matrix.rails }}.gemfile
57+ - name : Test
58+ env :
59+ BUNDLE_GEMFILE : gemfiles/activerecord_${{ matrix.rails }}.gemfile
60+ DATABASE_URL : ${{ matrix.adapter }}
61+ WITH_ADVISORY_LOCK_PREFIX : ${{ github.run_id }}
62+ run : bundle exec rake
Original file line number Diff line number Diff line change 33 pull_request :
44 branches :
55 - master
6+ concurrency :
7+ group : ci-postgresql-${{ github.head_ref }}
8+ cancel-in-progress : true
9+
610jobs :
711 minitest :
812 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 11---
2- name : CI
2+ name : CI Sqlite3
33
44on :
55 pull_request :
66 branches :
77 - master
88
9+ concurrency :
10+ group : ci-sqlite3-${{ github.head_ref }}
11+ cancel-in-progress : true
12+
913jobs :
1014 minitest :
1115 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 22
33module WithAdvisoryLock
44 class DatabaseAdapterSupport
5- # Caches nested lock support by MySQL reported version
6- @@mysql_nl_cache = { }
7- @@mysql_nl_cache_mutex = Mutex . new
8-
5+ attr_reader :adapter_name
96 def initialize ( connection )
107 @connection = connection
11- @sym_name = connection . adapter_name . downcase . to_sym
8+ @adapter_name = connection . adapter_name . downcase . to_sym
129 end
1310
1411 def mysql?
15- %i[ mysql2 trilogy ] . include? @sym_name
12+ %i[ mysql2 trilogy ] . include? adapter_name
1613 end
1714
1815 def postgresql?
19- %i[ postgresql empostgresql postgis ] . include? @sym_name
16+ %i[ postgresql empostgresql postgis ] . include? adapter_name
2017 end
2118
2219 def sqlite?
23- @sym_name == :sqlite3
20+ [ :sqlite3 , :sqlite ] . include? adapter_name
2421 end
2522 end
2623end
Original file line number Diff line number Diff line change 22
33module WithAdvisoryLock
44 class MySQL < Base
5+ # Caches nested lock support by MySQL reported version
6+ @@mysql_nl_cache = { }
7+ @@mysql_nl_cache_mutex = Mutex . new
58 # See https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_get-lock
69 def try_lock
710 raise ArgumentError , 'shared locks are not supported on MySQL' if shared
You can’t perform that action at this time.
0 commit comments