trx_ext 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/bin/test_all_ar_versions +1 -1
- data/docker-compose.yml +2 -2
- data/dummy_app/.gitignore +0 -4
- data/dummy_app/db/primary_mysql_schema.rb +20 -0
- data/dummy_app/db/primary_sqlite_schema.rb +20 -0
- data/dummy_app/db/primary_trilogy_schema.rb +20 -0
- data/dummy_app/db/schema.rb +23 -0
- data/lib/trx_ext/version.rb +1 -1
- data/lib/trx_ext.rb +17 -14
- data/trx_ext.gemspec +1 -1
- metadata +11 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52f0fff7319c96a73f1b8ebdd31319b39226eb0c6af85d079922df3e5050a217
|
|
4
|
+
data.tar.gz: 668acf38fe3f96493cb0a7904327f493404082bb113ceae0d750cd437eaebd76
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 135d27423fdf5631fbfdb3606f875241d93f963a15b96aa3c34aab1de005558a841d5e73caec64dca6fe424b53304255216fb0f6d66fbba5a03fa636c910bf89
|
|
7
|
+
data.tar.gz: 6c6887c5138835e6fa560310cf6ab259a89392458ca0318f95a7c26b5581f8982681c4056e53a8766add9ac93f4d9bc326c174e0fd3f03c839b81eada24b51c6
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.4.7
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
|
@@ -21,7 +21,7 @@ gem 'timecop', '~> 0.9.8'
|
|
|
21
21
|
# To support postgresql adapter
|
|
22
22
|
gem 'pg', '~> 1.5', '>= 1.5.4'
|
|
23
23
|
# To support sqlite3 adapter
|
|
24
|
-
gem 'sqlite3'
|
|
24
|
+
gem 'sqlite3'
|
|
25
25
|
# To support mysql2 adapter
|
|
26
26
|
gem 'mysql2', '~> 0.5.5'
|
|
27
27
|
# To support trilogy adapter
|
data/bin/test_all_ar_versions
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# frozen_string_literal: true
|
|
4
4
|
|
|
5
|
-
%w[7.2].each do |ar_version|
|
|
5
|
+
%w[7.2 8.0 8.1].each do |ar_version|
|
|
6
6
|
`rm Gemfile.lock`
|
|
7
7
|
Process.waitpid(Kernel.spawn({ 'AR_VERSION' => ar_version }, "bundle install --quiet", close_others: true))
|
|
8
8
|
Process.waitpid(Kernel.spawn({ 'AR_VERSION' => ar_version }, "rspec", close_others: true))
|
data/docker-compose.yml
CHANGED
|
@@ -2,14 +2,14 @@ version: "3.5"
|
|
|
2
2
|
|
|
3
3
|
services:
|
|
4
4
|
postgres:
|
|
5
|
-
image: postgres:
|
|
5
|
+
image: postgres:18
|
|
6
6
|
command: ["postgres", "-c", "log_statement=all", "-c", "default_transaction_isolation=serializable"]
|
|
7
7
|
ports:
|
|
8
8
|
- 5532:5432
|
|
9
9
|
environment:
|
|
10
10
|
- POSTGRES_PASSWORD=postgres
|
|
11
11
|
mysql:
|
|
12
|
-
image: mysql:
|
|
12
|
+
image: mysql:9.4
|
|
13
13
|
command:
|
|
14
14
|
- /usr/local/bin/mysqld.sh
|
|
15
15
|
volumes:
|
data/dummy_app/.gitignore
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
|
4
|
+
#
|
|
5
|
+
# This file is the source Rails uses to define your schema when running `bin/rails
|
|
6
|
+
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
|
7
|
+
# be faster and is potentially less error prone than running all of your
|
|
8
|
+
# migrations from scratch. Old migrations may fail to apply correctly if those
|
|
9
|
+
# migrations use external dependencies or application code.
|
|
10
|
+
#
|
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
|
12
|
+
|
|
13
|
+
ActiveRecord::Schema[7.2].define(version: 2024_01_28_111549) do
|
|
14
|
+
create_table "dummy_mysql_records", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
|
15
|
+
t.datetime "created_at", null: false
|
|
16
|
+
t.string "name"
|
|
17
|
+
t.string "unique_name"
|
|
18
|
+
t.index ["unique_name"], name: "index_dummy_mysql_records_on_unique_name", unique: true
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
|
4
|
+
#
|
|
5
|
+
# This file is the source Rails uses to define your schema when running `bin/rails
|
|
6
|
+
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
|
7
|
+
# be faster and is potentially less error prone than running all of your
|
|
8
|
+
# migrations from scratch. Old migrations may fail to apply correctly if those
|
|
9
|
+
# migrations use external dependencies or application code.
|
|
10
|
+
#
|
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
|
12
|
+
|
|
13
|
+
ActiveRecord::Schema[7.2].define(version: 2024_01_28_111549) do
|
|
14
|
+
create_table "dummy_sqlite_records", force: :cascade do |t|
|
|
15
|
+
t.datetime "created_at", null: false
|
|
16
|
+
t.string "name"
|
|
17
|
+
t.string "unique_name"
|
|
18
|
+
t.index ["unique_name"], name: "index_dummy_sqlite_records_on_unique_name", unique: true
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
|
4
|
+
#
|
|
5
|
+
# This file is the source Rails uses to define your schema when running `bin/rails
|
|
6
|
+
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
|
7
|
+
# be faster and is potentially less error prone than running all of your
|
|
8
|
+
# migrations from scratch. Old migrations may fail to apply correctly if those
|
|
9
|
+
# migrations use external dependencies or application code.
|
|
10
|
+
#
|
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
|
12
|
+
|
|
13
|
+
ActiveRecord::Schema[7.2].define(version: 2024_01_28_111549) do
|
|
14
|
+
create_table "dummy_trilogy_records", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
|
15
|
+
t.datetime "created_at", null: false
|
|
16
|
+
t.string "name"
|
|
17
|
+
t.string "unique_name"
|
|
18
|
+
t.index ["unique_name"], name: "index_dummy_trilogy_records_on_unique_name", unique: true
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
|
4
|
+
#
|
|
5
|
+
# This file is the source Rails uses to define your schema when running `bin/rails
|
|
6
|
+
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
|
7
|
+
# be faster and is potentially less error prone than running all of your
|
|
8
|
+
# migrations from scratch. Old migrations may fail to apply correctly if those
|
|
9
|
+
# migrations use external dependencies or application code.
|
|
10
|
+
#
|
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
|
12
|
+
|
|
13
|
+
ActiveRecord::Schema[7.2].define(version: 2024_01_28_111549) do
|
|
14
|
+
# These are extensions that must be enabled in order to support this database
|
|
15
|
+
enable_extension "pg_catalog.plpgsql"
|
|
16
|
+
|
|
17
|
+
create_table "dummy_pg_records", force: :cascade do |t|
|
|
18
|
+
t.datetime "created_at", null: false
|
|
19
|
+
t.string "name"
|
|
20
|
+
t.string "unique_name"
|
|
21
|
+
t.index ["unique_name"], name: "index_dummy_pg_records_on_unique_name", unique: true
|
|
22
|
+
end
|
|
23
|
+
end
|
data/lib/trx_ext/version.rb
CHANGED
data/lib/trx_ext.rb
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'active_record'
|
|
4
|
-
require_relative
|
|
5
|
-
require_relative
|
|
6
|
-
require_relative
|
|
7
|
-
require_relative
|
|
4
|
+
require_relative 'trx_ext/object_ext'
|
|
5
|
+
require_relative 'trx_ext/retry'
|
|
6
|
+
require_relative 'trx_ext/config'
|
|
7
|
+
require_relative 'trx_ext/version'
|
|
8
8
|
|
|
9
9
|
module TrxExt
|
|
10
|
+
SUPPORTED_ADAPTERS = %i[
|
|
11
|
+
active_record_mysql2adapter
|
|
12
|
+
active_record_postgresqladapter
|
|
13
|
+
active_record_sqlite3adapter
|
|
14
|
+
active_record_trilogyadapter
|
|
15
|
+
].freeze
|
|
16
|
+
|
|
10
17
|
class << self
|
|
11
18
|
attr_accessor :logger
|
|
12
19
|
|
|
@@ -14,10 +21,9 @@ module TrxExt
|
|
|
14
21
|
def integrate!
|
|
15
22
|
# Allow to use #wrap_in_trx and #trx methods everywhere
|
|
16
23
|
Object.prepend(TrxExt::ObjectExt)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
ActiveSupport.on_load(:active_record_trilogyadapter, &method(:integrate_into_class))
|
|
24
|
+
SUPPORTED_ADAPTERS.each do |adapter_name|
|
|
25
|
+
ActiveSupport.on_load(adapter_name, &method(:integrate_into_class))
|
|
26
|
+
end
|
|
21
27
|
end
|
|
22
28
|
|
|
23
29
|
# @return [void]
|
|
@@ -37,12 +43,9 @@ module TrxExt
|
|
|
37
43
|
private
|
|
38
44
|
|
|
39
45
|
def integrate_into_class(klass)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
TrxExt::Retry.with_retry_until_serialized(klass, :exec_update)
|
|
44
|
-
TrxExt::Retry.with_retry_until_serialized(klass, :exec_insert_all)
|
|
45
|
-
TrxExt::Retry.with_retry_until_serialized(klass, :transaction)
|
|
46
|
+
%i[exec_query exec_insert exec_delete exec_update exec_insert_all transaction].each do |method_name|
|
|
47
|
+
TrxExt::Retry.with_retry_until_serialized(klass, method_name)
|
|
48
|
+
end
|
|
46
49
|
end
|
|
47
50
|
end
|
|
48
51
|
end
|
data/trx_ext.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: trx_ext
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ivan Dzyzenko
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activerecord
|
|
@@ -19,7 +18,7 @@ dependencies:
|
|
|
19
18
|
version: '7.2'
|
|
20
19
|
- - "<"
|
|
21
20
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '8'
|
|
21
|
+
version: '8.2'
|
|
23
22
|
type: :runtime
|
|
24
23
|
prerelease: false
|
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -29,7 +28,7 @@ dependencies:
|
|
|
29
28
|
version: '7.2'
|
|
30
29
|
- - "<"
|
|
31
30
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '8'
|
|
31
|
+
version: '8.2'
|
|
33
32
|
description: Allow you to retry deadlocks, serialization errors, non-unique errors.
|
|
34
33
|
email:
|
|
35
34
|
- ivan.dzyzenko@gmail.com
|
|
@@ -85,8 +84,12 @@ files:
|
|
|
85
84
|
- dummy_app/db/migrate/.keep
|
|
86
85
|
- dummy_app/db/migrate/20240128111549_create_dummy_record.rb
|
|
87
86
|
- dummy_app/db/primary_mysql/20240128111549_create_dummy_mysql_record.rb
|
|
87
|
+
- dummy_app/db/primary_mysql_schema.rb
|
|
88
88
|
- dummy_app/db/primary_sqlite/20240128111549_create_dummy_sqlite_record.rb
|
|
89
|
+
- dummy_app/db/primary_sqlite_schema.rb
|
|
89
90
|
- dummy_app/db/primary_trilogy/20240128111549_create_dummy_trilogy_record.rb
|
|
91
|
+
- dummy_app/db/primary_trilogy_schema.rb
|
|
92
|
+
- dummy_app/db/schema.rb
|
|
90
93
|
- dummy_app/db/seeds.rb
|
|
91
94
|
- dummy_app/lib/tasks/.keep
|
|
92
95
|
- dummy_app/log/.keep
|
|
@@ -107,9 +110,8 @@ licenses:
|
|
|
107
110
|
metadata:
|
|
108
111
|
allowed_push_host: https://rubygems.org
|
|
109
112
|
homepage_uri: https://github.com/intale/trx_ext
|
|
110
|
-
source_code_uri: https://github.com/intale/trx_ext/tree/v3.0.
|
|
111
|
-
changelog_uri: https://github.com/intale/trx_ext/blob/v3.0.
|
|
112
|
-
post_install_message:
|
|
113
|
+
source_code_uri: https://github.com/intale/trx_ext/tree/v3.0.2
|
|
114
|
+
changelog_uri: https://github.com/intale/trx_ext/blob/v3.0.2/CHANGELOG.md
|
|
113
115
|
rdoc_options: []
|
|
114
116
|
require_paths:
|
|
115
117
|
- lib
|
|
@@ -124,8 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
124
126
|
- !ruby/object:Gem::Version
|
|
125
127
|
version: '0'
|
|
126
128
|
requirements: []
|
|
127
|
-
rubygems_version: 3.
|
|
128
|
-
signing_key:
|
|
129
|
+
rubygems_version: 3.6.9
|
|
129
130
|
specification_version: 4
|
|
130
131
|
summary: ActiveRecord's transaction extension
|
|
131
132
|
test_files: []
|