mongify 1.3.2 → 1.4.1

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: 9df23e8fc3b94b92b709ff1650178482c0dd184a44ce703c74fc40fc5b5e2b6f
4
+ data.tar.gz: 833b3a0068e9b9451a1cc26ec22c33673071b16bc848e4f8891fc09091b455e2
5
5
  SHA512:
6
- metadata.gz: 258b0d620e1b5de76f308aca344a50dc8a0f6ea6d9506f2558e2ee205394dc75dfe63111789995c2b307905b91eb926e7a33c407b58e276ffca131864a0f4908
7
- data.tar.gz: 77c2164795bfcf713b1af6af6eda7030f39c8b8b98bdc60e2f4871032e23e2fa43c755e7c0235bd3fb057edb9c83c321b004d31b9ce824753ece779a4b27a65d
6
+ metadata.gz: 8216795409436c7ad7c5164c0bce9baab5bdc7c24370809ea038a3935f970a1bf6a7efda2abe2f63159c8582f85a6da58265c3d8cd0e095e9b4b91e347264516
7
+ data.tar.gz: 4403a7f8792a1da7d3134052247714c6a0aff5ec2ab56d4ccb1da3d987e9c7707a09757da8e55e869da10447f033416ef15302f9f87eba1d8554c5874cea0b4c
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,38 @@
1
1
  # Mongify ChangeLog
2
2
 
3
+ ## 1.4.1 / 13 Jan 2026
4
+ * Added MongoDB 8.0 support and compatibility testing
5
+ * Fixed Ruby 3.4 compatibility:
6
+ - Added `abbrev` gem dependency (removed from Ruby 3.4 stdlib)
7
+ - Replaced deprecated `File.exists?` with `File.exist?`
8
+ - Updated cucumber dependency to >= 9.0
9
+ * Fixed batch insert compatibility with mongo driver 2.22+ (`insert_many` for arrays)
10
+ * Updated docker-compose.dev.yml to use MongoDB 8.0
11
+ * Documented tested MongoDB versions (4.4, 8.0) in README
12
+
13
+ ## 1.4.0 / 12 Jan 2026
14
+ * **BREAKING**: Ruby 3.0+ now required (was 2.5+)
15
+ * Upgraded to ActiveRecord/ActiveSupport 7.x (7.2.3)
16
+ * Upgraded to MongoDB Ruby Driver 2.x (2.22.0) - major API update from legacy 1.x driver
17
+ * Fixed all 11 Dependabot security vulnerabilities:
18
+ - CVE-2015-4411: BSON DoS vulnerability (upgraded bson to 5.2.0)
19
+ - CVE-2022-44566: ActiveRecord PostgreSQL adapter DoS
20
+ - CVE-2023-38037: ActiveSupport local file disclosure
21
+ - CVE-2025-55193: ActiveRecord ANSI escape injection
22
+ - Plus 7 other moderate/low severity issues
23
+ * Upgraded RSpec from 2.x to 3.x
24
+ * Fixed Ruby 3.x compatibility in DataRow#respond_to?
25
+ * Fixed Rails 7.0+ deprecation: Time#to_s(:db) -> Time#to_fs(:db)
26
+ * Removed explicit bson/bson_ext dependencies (now bundled with mongo gem)
27
+ * Updated ActiveRecord/ActiveSupport compatibility to support versions 4.2 through 6.0
28
+ * Updated minimum Ruby version to 2.5+
29
+ * Fixed ActiveRecord type casting API changes (`type_cast_from_database` -> `deserialize`)
30
+ * Fixed ActiveRecord::Migration version specification for Rails 5+
31
+ * Added Docker Compose setup for development databases (MongoDB, MySQL, PostgreSQL)
32
+ * Added `bin/dev-db` script to manage development databases
33
+ * Added `bin/test-setup` script to setup test database schema
34
+ * Fixed Rake compatibility with rake 12+ and rspec-core 2.x
35
+
3
36
  ## 1.3.2 / 04 Sep 2017
4
37
  * Minor code refactoring
5
38
  * Removed exception handling around ALL exceptions (this should improve finding issues outside of Mongify)
@@ -167,4 +200,4 @@
167
200
  * Improved tests to cover most of the code
168
201
  * Changed overall commands for Mongify
169
202
  ## 0.0.1 / 22 Mar 2010
170
- * Initial Setup
203
+ * Initial Setup
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
+ abbrev
6
+ activerecord (>= 7.1.5.2, < 8.0)
7
+ activesupport (>= 7.1.5.2, < 8.0)
8
+ highline (>= 1.7.8)
9
+ mongo (~> 2.19)
11
10
 
12
11
  GEM
13
- remote: http://rubygems.org/
12
+ remote: https://rubygems.org/
14
13
  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)
14
+ abbrev (0.1.2)
15
+ activemodel (7.2.3)
16
+ activesupport (= 7.2.3)
17
+ activerecord (7.2.3)
18
+ activemodel (= 7.2.3)
19
+ activesupport (= 7.2.3)
20
+ timeout (>= 0.4.0)
21
+ activesupport (7.2.3)
22
+ base64
23
+ benchmark (>= 0.3)
24
+ bigdecimal
25
+ concurrent-ruby (~> 1.0, >= 1.3.1)
26
+ connection_pool (>= 2.2.5)
27
+ drb
28
+ i18n (>= 1.6, < 2)
29
+ logger (>= 1.4.2)
30
+ minitest (>= 5.1)
31
+ securerandom (>= 0.3)
32
+ tzinfo (~> 2.0, >= 2.0.5)
33
+ amazing_print (1.6.0)
34
+ base64 (0.3.0)
35
+ benchmark (0.5.0)
36
+ bigdecimal (4.0.1)
37
+ bson (5.2.0)
38
+ builder (3.3.0)
39
+ byebug (11.1.3)
40
+ coderay (1.1.3)
41
+ concurrent-ruby (1.3.6)
42
+ connection_pool (2.5.5)
36
43
  coolline (0.5.0)
37
44
  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)
45
+ cucumber (10.2.0)
46
+ base64 (~> 0.2)
47
+ builder (~> 3.2)
48
+ cucumber-ci-environment (> 9, < 12)
49
+ cucumber-core (> 15, < 17)
50
+ cucumber-cucumber-expressions (> 17, < 20)
51
+ cucumber-html-formatter (> 21, < 23)
52
+ diff-lcs (~> 1.5)
53
+ logger (~> 1.6)
54
+ mini_mime (~> 1.1)
55
+ multi_test (~> 1.1)
56
+ sys-uname (~> 1.3)
57
+ cucumber-ci-environment (11.0.0)
58
+ cucumber-core (16.1.1)
59
+ cucumber-gherkin (> 36, < 40)
60
+ cucumber-messages (> 31, < 33)
61
+ cucumber-tag-expressions (> 6, < 9)
62
+ cucumber-cucumber-expressions (18.0.1)
63
+ bigdecimal
64
+ cucumber-gherkin (37.0.1)
65
+ cucumber-messages (>= 31, < 32)
66
+ cucumber-html-formatter (22.3.0)
67
+ cucumber-messages (> 23, < 33)
68
+ cucumber-messages (31.2.0)
69
+ cucumber-tag-expressions (8.1.0)
70
+ diff-lcs (1.6.2)
71
+ drb (2.2.3)
72
+ ffi (1.17.3-arm64-darwin)
73
+ highline (2.1.0)
74
+ i18n (1.14.8)
75
+ concurrent-ruby (~> 1.0)
76
+ jazz_fingers (6.2.0)
77
+ amazing_print (~> 1.3)
57
78
  pry (~> 0.10)
58
- pry-byebug (~> 3.4)
79
+ pry-byebug (~> 3.9)
59
80
  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)
81
+ logger (1.7.0)
82
+ memoist3 (1.0.0)
83
+ method_source (1.1.0)
84
+ mini_mime (1.1.5)
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 (2.9.0-arm64-darwin)
123
+ sys-uname (1.4.1)
124
+ ffi (~> 1.1)
125
+ memoist3 (~> 1.0.0)
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
- cucumber (>= 0.10)
137
+ cucumber (>= 9.0)
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
 
@@ -9,7 +10,10 @@ A data translator from sql database to mongoDB.
9
10
  Supports MySQL, PostgreSQL, SQLite, Oracle, SQLServer, and DB2 (Basically anything ActiveRecord has built-in).
10
11
  However, I've only tested it with MySql and SQLite
11
12
 
12
- Supports any version of MongoDB
13
+ === Tested MongoDB Versions
14
+
15
+ * MongoDB 4.4
16
+ * MongoDB 8.0
13
17
 
14
18
  Learn more about MongoDB at: http://www.mongodb.org
15
19
 
@@ -265,7 +269,7 @@ More documentation can be found at {Mongify::Database::Column}
265
269
 
266
270
  == Notes
267
271
 
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
272
+ Mongify requires Ruby 2.5 or higher.
269
273
 
270
274
  If you have any issues, please feel free to report them here: {issue tracker}[https://github.com/anlek/mongify/issues]
271
275
 
@@ -290,14 +294,18 @@ Check out the gem at: {http://rubygems.org/gems/mongify-mongoid}[http://rubygems
290
294
 
291
295
  === Requirements
292
296
 
293
- You just need bundler >= 1.0.8
297
+ You need bundler and Docker installed.
294
298
 
295
299
  gem install bundler
296
300
  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
301
+ cp spec/support/database.example spec/support/database.yml
302
+ bin/dev-db up
303
+ bin/test-setup
304
+ bundle exec rspec
305
+
306
+ To stop the development databases:
307
+
308
+ bin/dev-db down
301
309
 
302
310
  == Special Thanks
303
311
 
@@ -324,7 +332,7 @@ Reach me at:
324
332
 
325
333
  == License
326
334
 
327
- Copyright (c) 2011 - 2013 Andrew Kalek, Anlek Consulting
335
+ Copyright (c) 2011 - 2026 Andrew Kalek, Anlek Consulting
328
336
 
329
337
  Permission is hereby granted, free of charge, to any person obtaining
330
338
  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:8.0
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:
@@ -26,7 +26,7 @@ module MongifyWorld
26
26
 
27
27
  # Executes mongify command with arguments
28
28
  def mongify(args)
29
- run("ruby -Ilib -rubygems bin/mongify #{args}")
29
+ run("bundle exec ruby -Ilib bin/mongify #{args}")
30
30
  end
31
31
  end
32
32
 
@@ -55,7 +55,7 @@ module Mongify
55
55
  raise ConfigurationFileNotFound, "Database Configuration file is missing or cannot be found" if command_options[:required] && command_options[:required].include?(:configuration_file) && @config.nil?
56
56
  if command_options[:required] && command_options[:required].include?(:translation_file)
57
57
  raise TranslationFileNotFound, "Translation file is required for command '#{current_command}'" unless @translation_file
58
- raise TranslationFileNotFound, "Unable to find Translation File at #{@translation_file}" unless File.exists?(@translation_file)
58
+ raise TranslationFileNotFound, "Unable to find Translation File at #{@translation_file}" unless File.exist?(@translation_file)
59
59
  @translation = Translation.parse(@translation_file)
60
60
  end
61
61
  end
@@ -9,7 +9,7 @@ module Mongify
9
9
 
10
10
  # Parses a external configuration file and evaluates it and returns a instence of a configuration class
11
11
  def parse(file_name)
12
- raise Mongify::ConfigurationFileNotFound, "File #{file_name} is missing" unless File.exists?(file_name)
12
+ raise Mongify::ConfigurationFileNotFound, "File #{file_name} is missing" unless File.exist?(file_name)
13
13
  config = self.new
14
14
  config.instance_eval(File.read(file_name))
15
15
  config
@@ -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