mongify 1.3.2 → 1.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2c9b7a85234abf8705ad06a4f3b17df8b041f347
4
- data.tar.gz: 88ac19500da4d1bf630de63a79273dafa09e91f9
2
+ SHA256:
3
+ metadata.gz: d206704186fb2f3540e6c6528859b5b28dd50476d5cd9e59037a95bdcf105095
4
+ data.tar.gz: 19f7951ac4286722d6fd12bdde9b6b27428bc18658c94bf75c521cf9baca37d7
5
5
  SHA512:
6
- metadata.gz: 258b0d620e1b5de76f308aca344a50dc8a0f6ea6d9506f2558e2ee205394dc75dfe63111789995c2b307905b91eb926e7a33c407b58e276ffca131864a0f4908
7
- data.tar.gz: 77c2164795bfcf713b1af6af6eda7030f39c8b8b98bdc60e2f4871032e23e2fa43c755e7c0235bd3fb057edb9c83c321b004d31b9ce824753ece779a4b27a65d
6
+ metadata.gz: cd9958f34535ef538bf93ec31fa1b16f0f18a949644fa0b3fe793a33d663fcd6e84a1d2fd4f69da133a9d7ff52934c742039f41041fa11bd3c6e220825454c45
7
+ data.tar.gz: e26d6525de4971d3941bf55325b6645e695d967068fb0dc0fbfb38d8526f0ec47f6487e2fbf7b4c989972b9745b5eae545acbf3c5af095952dd6d129814d0b8a
data/.gitignore CHANGED
@@ -29,3 +29,6 @@ spec/support/database.yml
29
29
 
30
30
 
31
31
  log/deprecations.log
32
+
33
+ vender/
34
+ .tool-versions
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Mongify ChangeLog
2
2
 
3
+ ## 1.4.0 / 12 Jan 2026
4
+ * **BREAKING**: Ruby 3.0+ now required (was 2.5+)
5
+ * Upgraded to ActiveRecord/ActiveSupport 7.x (7.2.3)
6
+ * Upgraded to MongoDB Ruby Driver 2.x (2.22.0) - major API update from legacy 1.x driver
7
+ * Fixed all 11 Dependabot security vulnerabilities:
8
+ - CVE-2015-4411: BSON DoS vulnerability (upgraded bson to 5.2.0)
9
+ - CVE-2022-44566: ActiveRecord PostgreSQL adapter DoS
10
+ - CVE-2023-38037: ActiveSupport local file disclosure
11
+ - CVE-2025-55193: ActiveRecord ANSI escape injection
12
+ - Plus 7 other moderate/low severity issues
13
+ * Upgraded RSpec from 2.x to 3.x
14
+ * Fixed Ruby 3.x compatibility in DataRow#respond_to?
15
+ * Fixed Rails 7.0+ deprecation: Time#to_s(:db) -> Time#to_fs(:db)
16
+ * Removed explicit bson/bson_ext dependencies (now bundled with mongo gem)
17
+
18
+ ## 1.3.3 / 12 Jan 2026
19
+ * Updated ActiveRecord/ActiveSupport compatibility to support versions 4.2 through 6.0
20
+ * Updated minimum Ruby version to 2.5+
21
+ * Fixed ActiveRecord type casting API changes (`type_cast_from_database` -> `deserialize`)
22
+ * Fixed ActiveRecord::Migration version specification for Rails 5+
23
+ * Added Docker Compose setup for development databases (MongoDB, MySQL, PostgreSQL)
24
+ * Added `bin/dev-db` script to manage development databases
25
+ * Added `bin/test-setup` script to setup test database schema
26
+ * Fixed Rake compatibility with rake 12+ and rspec-core 2.x
27
+
3
28
  ## 1.3.2 / 04 Sep 2017
4
29
  * Minor code refactoring
5
30
  * Removed exception handling around ALL exceptions (this should improve finding issues outside of Mongify)
data/CLAUDE.md ADDED
@@ -0,0 +1,101 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ Mongify is a Ruby gem that translates data from SQL databases (MySQL, PostgreSQL, SQLite, Oracle, SQLServer, DB2) to MongoDB. It uses a DSL-based translation file to define how tables map to MongoDB collections, including support for embedding documents and handling polymorphic relationships.
8
+
9
+ ## Common Commands
10
+
11
+ ```bash
12
+ # Install dependencies
13
+ bundle install
14
+
15
+ # Run all tests (RSpec + Cucumber)
16
+ rake test
17
+
18
+ # Run only RSpec tests
19
+ rake test:rspec
20
+
21
+ # Run only Cucumber features
22
+ rake test:cucumber
23
+
24
+ # Run a single spec file
25
+ bundle exec rspec spec/mongify/database/table_spec.rb
26
+
27
+ # Run a single Cucumber feature
28
+ bundle exec cucumber features/process.feature
29
+
30
+ # Setup test databases (requires database.yml configuration)
31
+ rake test:setup:mysql
32
+ rake test:setup:postgresql
33
+
34
+ # Build the gem
35
+ rake build
36
+ ```
37
+
38
+ ## Test Database Setup
39
+
40
+ ### Using Docker (Recommended)
41
+
42
+ ```bash
43
+ # Start all databases (MongoDB, MySQL, PostgreSQL)
44
+ bin/dev-db up
45
+
46
+ # Setup test database schema
47
+ bin/test-setup
48
+
49
+ # Run tests
50
+ bundle exec rspec
51
+
52
+ # Stop databases
53
+ bin/dev-db down
54
+ ```
55
+
56
+ ### Manual Setup
57
+
58
+ Copy `spec/support/database.example` to `spec/support/database.yml` and configure your MySQL/PostgreSQL/MongoDB connection settings.
59
+
60
+ ## Architecture
61
+
62
+ ### Core Processing Pipeline
63
+
64
+ 1. **Configuration** (`lib/mongify/configuration.rb`) - Parses database connection config files defining `sql_connection` and `mongodb_connection` blocks
65
+ 2. **Translation** (`lib/mongify/translation.rb`) - Parses translation files that define table/column mappings using the DSL
66
+ 3. **Process/Sync** (`lib/mongify/translation/process.rb`, `sync.rb`) - Executes the translation:
67
+ - `copy_data` - Copies non-embedded tables
68
+ - `update_reference_ids` - Updates foreign key references to MongoDB ObjectIDs
69
+ - `copy_embedded_tables` - Embeds documents into parent collections
70
+ - `copy_polymorphic_tables` - Handles polymorphic relationships
71
+
72
+ ### Key Domain Objects
73
+
74
+ - **`Database::Table`** (`lib/mongify/database/table.rb`) - Represents a SQL table with options for embedding (`:embed_in`, `:as`, `:on`), renaming (`:rename_to`), polymorphism (`:polymorphic`), and `before_save` callbacks
75
+ - **`Database::Column`** (`lib/mongify/database/column.rb`) - Represents a column with type casting, reference tracking (`:references`), and rename support
76
+ - **`Database::DataRow`** (`lib/mongify/database/data_row.rb`) - Hash wrapper used in `before_save` callbacks for row manipulation
77
+
78
+ ### CLI Structure
79
+
80
+ Entry point: `bin/mongify` → `CLI::Application` → `CLI::Options` → `CLI::Command::Worker`
81
+
82
+ Commands: `check`, `translation`, `process`, `sync`
83
+
84
+ ### Translation DSL
85
+
86
+ The DSL uses `instance_eval` to parse translation files. Tables can be:
87
+ - **Copy tables** - Straight copy to MongoDB collection
88
+ - **Embedded tables** - Embedded as array or object within parent document
89
+ - **Polymorphic tables** - Embedded based on `*_type` column value
90
+
91
+ ## Important Rules
92
+
93
+ - **NEVER remove or delete `Gemfile.lock`** - Always use `bundle update <gem>` to update specific gems instead of regenerating the entire lockfile.
94
+ - **NEVER use `git push --force`** - Avoid force pushing. Keep commit history intact.
95
+
96
+ ## Dependencies
97
+
98
+ - ActiveRecord 6.0.x for SQL database connectivity
99
+ - mongo/bson 1.12.5 for MongoDB connectivity
100
+ - RSpec 2.x for unit tests
101
+ - Cucumber for integration tests
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in template_del.gemspec
4
- gemspec
3
+ # Specify your gem's dependencies in mongify.gemspec
4
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,123 +1,151 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongify (1.3.2)
5
- activerecord (>= 4.2, < 5.0)
6
- activesupport (>= 4.2, < 5.0)
7
- bson (= 1.12.5)
8
- bson_ext (= 1.12.5)
9
- highline (= 1.7.8)
10
- mongo (= 1.12.5)
4
+ mongify (1.4.0)
5
+ activerecord (>= 7.1.5.2, < 8.0)
6
+ activesupport (>= 7.1.5.2, < 8.0)
7
+ highline (>= 1.7.8)
8
+ mongo (~> 2.19)
11
9
 
12
10
  GEM
13
- remote: http://rubygems.org/
11
+ remote: https://rubygems.org/
14
12
  specs:
15
- activemodel (4.2.7.1)
16
- activesupport (= 4.2.7.1)
17
- builder (~> 3.1)
18
- activerecord (4.2.7.1)
19
- activemodel (= 4.2.7.1)
20
- activesupport (= 4.2.7.1)
21
- arel (~> 6.0)
22
- activesupport (4.2.7.1)
23
- i18n (~> 0.7)
24
- json (~> 1.7, >= 1.7.7)
25
- minitest (~> 5.1)
26
- thread_safe (~> 0.3, >= 0.3.4)
27
- tzinfo (~> 1.1)
28
- arel (6.0.3)
29
- awesome_print (1.7.0)
30
- bson (1.12.5)
31
- bson_ext (1.12.5)
32
- bson (~> 1.12.5)
33
- builder (3.2.2)
34
- byebug (9.0.6)
35
- coderay (1.1.1)
13
+ activemodel (7.2.3)
14
+ activesupport (= 7.2.3)
15
+ activerecord (7.2.3)
16
+ activemodel (= 7.2.3)
17
+ activesupport (= 7.2.3)
18
+ timeout (>= 0.4.0)
19
+ activesupport (7.2.3)
20
+ base64
21
+ benchmark (>= 0.3)
22
+ bigdecimal
23
+ concurrent-ruby (~> 1.0, >= 1.3.1)
24
+ connection_pool (>= 2.2.5)
25
+ drb
26
+ i18n (>= 1.6, < 2)
27
+ logger (>= 1.4.2)
28
+ minitest (>= 5.1)
29
+ securerandom (>= 0.3)
30
+ tzinfo (~> 2.0, >= 2.0.5)
31
+ amazing_print (1.6.0)
32
+ base64 (0.3.0)
33
+ benchmark (0.5.0)
34
+ bigdecimal (4.0.1)
35
+ bson (5.2.0)
36
+ builder (3.3.0)
37
+ byebug (11.1.3)
38
+ coderay (1.1.3)
39
+ concurrent-ruby (1.3.6)
40
+ connection_pool (2.5.5)
36
41
  coolline (0.5.0)
37
42
  unicode_utils (~> 1.4)
38
- cucumber (2.4.0)
39
- builder (>= 2.1.2)
40
- cucumber-core (~> 1.5.0)
41
- cucumber-wire (~> 0.0.1)
42
- diff-lcs (>= 1.1.3)
43
- gherkin (~> 4.0)
44
- multi_json (>= 1.7.5, < 2.0)
45
- multi_test (>= 0.1.2)
46
- cucumber-core (1.5.0)
47
- gherkin (~> 4.0)
48
- cucumber-wire (0.0.1)
49
- diff-lcs (1.2.5)
50
- gherkin (4.0.0)
51
- highline (1.7.8)
52
- hirb (0.7.3)
53
- i18n (0.7.0)
54
- jazz_fingers (4.0.1)
55
- awesome_print (~> 1.6)
56
- hirb (~> 0.7)
43
+ cucumber (8.0.0)
44
+ builder (~> 3.2, >= 3.2.4)
45
+ cucumber-ci-environment (~> 9.0, >= 9.0.4)
46
+ cucumber-core (~> 11.0, >= 11.0.0)
47
+ cucumber-cucumber-expressions (~> 15.1, >= 15.1.1)
48
+ cucumber-gherkin (~> 23.0, >= 23.0.1)
49
+ cucumber-html-formatter (~> 19.1, >= 19.1.0)
50
+ cucumber-messages (~> 18.0, >= 18.0.0)
51
+ diff-lcs (~> 1.5, >= 1.5.0)
52
+ mime-types (~> 3.4, >= 3.4.1)
53
+ multi_test (~> 1.1, >= 1.1.0)
54
+ sys-uname (~> 1.2, >= 1.2.2)
55
+ cucumber-ci-environment (9.2.0)
56
+ cucumber-core (11.0.0)
57
+ cucumber-gherkin (~> 23.0, >= 23.0.1)
58
+ cucumber-messages (~> 18.0, >= 18.0.0)
59
+ cucumber-tag-expressions (~> 4.1, >= 4.1.0)
60
+ cucumber-cucumber-expressions (15.2.0)
61
+ cucumber-gherkin (23.0.1)
62
+ cucumber-messages (~> 18.0, >= 18.0.0)
63
+ cucumber-html-formatter (19.2.0)
64
+ cucumber-messages (~> 18.0, >= 18.0.0)
65
+ cucumber-messages (18.0.0)
66
+ cucumber-tag-expressions (4.1.0)
67
+ diff-lcs (1.6.2)
68
+ drb (2.2.3)
69
+ ffi (1.17.3-arm64-darwin)
70
+ highline (2.1.0)
71
+ i18n (1.14.8)
72
+ concurrent-ruby (~> 1.0)
73
+ jazz_fingers (6.2.0)
74
+ amazing_print (~> 1.3)
57
75
  pry (~> 0.10)
58
- pry-byebug (~> 3.4)
76
+ pry-byebug (~> 3.9)
59
77
  pry-coolline (~> 0.2)
60
- pry-doc (~> 0.6)
61
- json (1.8.3)
62
- metaclass (0.0.4)
63
- method_source (0.8.2)
64
- minitest (5.9.1)
65
- mocha (1.2.1)
66
- metaclass (~> 0.0.1)
67
- mongo (1.12.5)
68
- bson (= 1.12.5)
69
- multi_json (1.12.1)
70
- multi_test (0.1.2)
71
- mysql2 (0.4.5)
72
- pg (0.19.0)
73
- pry (0.10.4)
74
- coderay (~> 1.1.0)
75
- method_source (~> 0.8.1)
76
- slop (~> 3.4)
77
- pry-byebug (3.4.0)
78
- byebug (~> 9.0)
79
- pry (~> 0.10)
80
- pry-coolline (0.2.5)
78
+ logger (1.7.0)
79
+ memoist (0.16.2)
80
+ method_source (1.1.0)
81
+ mime-types (3.7.0)
82
+ logger
83
+ mime-types-data (~> 3.2025, >= 3.2025.0507)
84
+ mime-types-data (3.2025.0924)
85
+ minitest (5.27.0)
86
+ mocha (3.0.1)
87
+ ruby2_keywords (>= 0.0.5)
88
+ mongo (2.22.0)
89
+ base64
90
+ bson (>= 4.14.1, < 6.0.0)
91
+ multi_test (1.1.0)
92
+ mysql2 (0.5.7)
93
+ bigdecimal
94
+ pg (1.5.9)
95
+ pry (0.13.1)
96
+ coderay (~> 1.1)
97
+ method_source (~> 1.0)
98
+ pry-byebug (3.9.0)
99
+ byebug (~> 11.0)
100
+ pry (~> 0.13.0)
101
+ pry-coolline (0.2.6)
81
102
  coolline (~> 0.5)
82
- pry-doc (0.9.0)
83
- pry (~> 0.9)
84
- yard (~> 0.8)
85
- rake (11.3.0)
86
- rspec (2.99.0)
87
- rspec-core (~> 2.99.0)
88
- rspec-expectations (~> 2.99.0)
89
- rspec-mocks (~> 2.99.0)
90
- rspec-collection_matchers (1.1.2)
103
+ pry (~> 0.13)
104
+ rake (13.3.1)
105
+ rspec (3.13.2)
106
+ rspec-core (~> 3.13.0)
107
+ rspec-expectations (~> 3.13.0)
108
+ rspec-mocks (~> 3.13.0)
109
+ rspec-collection_matchers (1.2.1)
91
110
  rspec-expectations (>= 2.99.0.beta1)
92
- rspec-core (2.99.2)
93
- rspec-expectations (2.99.2)
94
- diff-lcs (>= 1.1.3, < 2.0)
95
- rspec-mocks (2.99.4)
96
- slop (3.6.0)
97
- sqlite3 (1.3.12)
98
- thread_safe (0.3.5)
99
- tzinfo (1.2.2)
100
- thread_safe (~> 0.1)
111
+ rspec-core (3.13.6)
112
+ rspec-support (~> 3.13.0)
113
+ rspec-expectations (3.13.5)
114
+ diff-lcs (>= 1.2.0, < 2.0)
115
+ rspec-support (~> 3.13.0)
116
+ rspec-mocks (3.13.7)
117
+ diff-lcs (>= 1.2.0, < 2.0)
118
+ rspec-support (~> 3.13.0)
119
+ rspec-support (3.13.6)
120
+ ruby2_keywords (0.0.5)
121
+ securerandom (0.4.1)
122
+ sqlite3 (1.6.9-arm64-darwin)
123
+ sys-uname (1.4.0)
124
+ ffi (~> 1.1)
125
+ memoist (~> 0.16.2)
126
+ timeout (0.6.0)
127
+ tzinfo (2.0.6)
128
+ concurrent-ruby (~> 1.0)
101
129
  unicode_utils (1.4.0)
102
130
  watchr (0.7)
103
- yard (0.9.5)
131
+ yard (0.9.38)
104
132
 
105
133
  PLATFORMS
106
- ruby
134
+ arm64-darwin-25
107
135
 
108
136
  DEPENDENCIES
109
137
  cucumber (>= 0.10)
110
138
  jazz_fingers
111
139
  mocha (>= 0.9.8)
112
140
  mongify!
113
- mysql2 (>= 0.4)
141
+ mysql2 (>= 0.4.10)
114
142
  pg (>= 0.17)
115
143
  rake
116
- rspec (~> 2.0)
144
+ rspec (~> 3.0)
117
145
  rspec-collection_matchers (~> 1.0)
118
146
  sqlite3 (>= 1.3)
119
147
  watchr (>= 0.6)
120
- yard (>= 0.8)
148
+ yard (~> 0.9.11)
121
149
 
122
150
  BUNDLED WITH
123
- 1.15.4
151
+ 2.3.27
data/README.rdoc CHANGED
@@ -1,6 +1,7 @@
1
1
  = Mongify
2
2
 
3
3
  {<img src="https://badges.gitter.im/Join%20Chat.svg" alt="Join the chat at https://gitter.im/anlek/mongify">}[https://gitter.im/anlek/mongify?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge]
4
+ {<img src="https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg" alt="Reviewed by Hound">}[https://houndci.com]
4
5
 
5
6
  http://mongify.com
6
7
 
@@ -265,7 +266,7 @@ More documentation can be found at {Mongify::Database::Column}
265
266
 
266
267
  == Notes
267
268
 
268
- Mongify has been tested on Ruby 1.8.7-p330, 1.9.2-p136, 1.9.3-p327, 2.0.0-p353, 2.1.1
269
+ Mongify requires Ruby 2.5 or higher.
269
270
 
270
271
  If you have any issues, please feel free to report them here: {issue tracker}[https://github.com/anlek/mongify/issues]
271
272
 
@@ -290,14 +291,18 @@ Check out the gem at: {http://rubygems.org/gems/mongify-mongoid}[http://rubygems
290
291
 
291
292
  === Requirements
292
293
 
293
- You just need bundler >= 1.0.8
294
+ You need bundler and Docker installed.
294
295
 
295
296
  gem install bundler
296
297
  bundle install
297
- copy over spec/support/database.example to spec/support/database.yml and fill in required info
298
- rake test:setup:mysql
299
- rake test:setup:postgresql
300
- rake test
298
+ cp spec/support/database.example spec/support/database.yml
299
+ bin/dev-db up
300
+ bin/test-setup
301
+ bundle exec rspec
302
+
303
+ To stop the development databases:
304
+
305
+ bin/dev-db down
301
306
 
302
307
  == Special Thanks
303
308
 
@@ -324,7 +329,7 @@ Reach me at:
324
329
 
325
330
  == License
326
331
 
327
- Copyright (c) 2011 - 2013 Andrew Kalek, Anlek Consulting
332
+ Copyright (c) 2011 - 2026 Andrew Kalek, Anlek Consulting
328
333
 
329
334
  Permission is hereby granted, free of charge, to any person obtaining
330
335
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -1,6 +1,16 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
3
 
4
+ # Compatibility shim for rake 12+ with rspec-core 2.x
5
+ # last_comment was removed in rake 12, but rspec-core 2.x still uses it
6
+ module Rake
7
+ class Application
8
+ def last_comment
9
+ last_description
10
+ end
11
+ end
12
+ end
13
+
4
14
  require 'cucumber/rake/task'
5
15
  require 'rspec/core/rake_task'
6
16
 
@@ -117,7 +127,8 @@ namespace :test do
117
127
  end
118
128
 
119
129
  def create_mysql_database(config)
120
- client = Mysql2::Client.new(host: config.mysql["host"] || "localhost",
130
+ client = Mysql2::Client.new(host: config.mysql["host"] || "127.0.0.1",
131
+ port: config.mysql["port"] || 3306,
121
132
  username: config.mysql["username"] || "root",
122
133
  password: config.mysql["password"])
123
134
 
data/bin/dev-db ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bash
2
+ # Start development databases (MongoDB, MySQL, PostgreSQL) using Docker
3
+
4
+ set -e
5
+
6
+ cd "$(dirname "$0")/.."
7
+
8
+ case "${1:-up}" in
9
+ up|start)
10
+ echo "Starting development databases..."
11
+ docker compose -f docker-compose.dev.yml up -d
12
+ echo "Waiting for databases to be ready..."
13
+ sleep 5
14
+ echo "Databases are running:"
15
+ docker compose -f docker-compose.dev.yml ps
16
+ ;;
17
+ down|stop)
18
+ echo "Stopping development databases..."
19
+ docker compose -f docker-compose.dev.yml down
20
+ ;;
21
+ status|ps)
22
+ docker compose -f docker-compose.dev.yml ps
23
+ ;;
24
+ logs)
25
+ docker compose -f docker-compose.dev.yml logs -f
26
+ ;;
27
+ *)
28
+ echo "Usage: $0 {up|down|status|logs}"
29
+ echo " up|start - Start all databases"
30
+ echo " down|stop - Stop all databases"
31
+ echo " status|ps - Show database status"
32
+ echo " logs - Follow database logs"
33
+ exit 1
34
+ ;;
35
+ esac
data/bin/test-setup ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env bash
2
+ # Setup test databases (creates tables and schema)
3
+
4
+ set -e
5
+
6
+ cd "$(dirname "$0")/.."
7
+
8
+ echo "Setting up MySQL test database..."
9
+ bundle exec rake test:setup:mysql
10
+
11
+ echo "Test database setup complete!"
@@ -0,0 +1,38 @@
1
+ services:
2
+ mongodb:
3
+ image: mongo:4.4
4
+ container_name: mongify_mongodb
5
+ ports:
6
+ - "27017:27017"
7
+ volumes:
8
+ - mongodb_data:/data/db
9
+ environment:
10
+ MONGO_INITDB_DATABASE: mongify_test
11
+
12
+ mysql:
13
+ image: mysql:8.0
14
+ container_name: mongify_mysql
15
+ ports:
16
+ - "3306:3306"
17
+ volumes:
18
+ - mysql_data:/var/lib/mysql
19
+ environment:
20
+ MYSQL_ROOT_PASSWORD: passw0rd
21
+ MYSQL_DATABASE: mongify_test
22
+
23
+ postgresql:
24
+ image: postgres:14
25
+ container_name: mongify_postgresql
26
+ ports:
27
+ - "5432:5432"
28
+ volumes:
29
+ - postgresql_data:/var/lib/postgresql/data
30
+ environment:
31
+ POSTGRES_USER: root
32
+ POSTGRES_PASSWORD: passw0rd
33
+ POSTGRES_DB: mongify_test
34
+
35
+ volumes:
36
+ mongodb_data:
37
+ mysql_data:
38
+ postgresql_data:
@@ -237,18 +237,18 @@ module Mongify
237
237
  when :integer then value.to_i
238
238
  when :float then value.to_f
239
239
  when :decimal
240
- value = ActiveRecord::Type::Decimal.new.type_cast_from_database(value)
240
+ value = ActiveModel::Type::Decimal.new.deserialize(value)
241
241
  if as_integer?
242
242
  (value * (10 ** self.scale)).round.to_i
243
243
  else
244
244
  value.to_s
245
245
  end
246
- when :datetime then ActiveRecord::Type::DateTime.new.type_cast_from_database(value)
247
- when :timestamp then ActiveRecord::Type::DateTime.new.type_cast_from_database(value)
248
- when :time then ActiveRecord::Type::Time.new.type_cast_from_database(value)
249
- when :date then ActiveRecord::Type::DateTime.new.type_cast_from_database(value)
250
- when :binary then ActiveRecord::Type::Binary.new.type_cast_from_database(value)
251
- when :boolean then ActiveRecord::Type::Boolean.new.type_cast_from_database(value)
246
+ when :datetime then ActiveRecord::Type::DateTime.new.deserialize(value)
247
+ when :timestamp then ActiveRecord::Type::DateTime.new.deserialize(value)
248
+ when :time then ActiveRecord::Type::Time.new.deserialize(value)
249
+ when :date then ActiveRecord::Type::DateTime.new.deserialize(value)
250
+ when :binary then ActiveModel::Type::Binary.new.deserialize(value)
251
+ when :boolean then ActiveModel::Type::Boolean.new.deserialize(value)
252
252
  else value.to_s
253
253
  end
254
254
  end
@@ -43,9 +43,9 @@ module Mongify
43
43
  end
44
44
 
45
45
  # Updated respond_to to return true if it's a key the hash
46
- def respond_to?(method)
47
- return true if @hash.has_key?(method.gsub('=', ''))
48
- super(method)
46
+ def respond_to?(method, include_private = false)
47
+ return true if @hash.has_key?(method.to_s.gsub('=', ''))
48
+ super
49
49
  end
50
50
 
51
51
  # Added the ability to read and write attributes in the hash