Mongify可行性研究(失败)
Mongify是一个迁移SQL数据库数据到MongoDB的Ruby工具。最近有项目需要把数据从SQLServer迁移到MongoDB,所以来看看这个工具好使不。
Mongify支持很多SQL数据库,包含MySQL, PostgreSQL, SQLite, Oracle, SQLServer, and DB2,但是作者只在MySql和SQLite上测试过。
大家可以看看[官网][Mongify]上的视频,很直观。
安装
1 | gem install mongify |
遇到错误:
1 | ERROR: While executing gem ... (Gem::DependencyError) |
参考官网的issue,应该是我本机的ruby太久了,需要升级。可以使用rvm来管理ruby版本:
1 | $ ruby -v |
再次安装mongify成功。
编写配置文件
1 | sql_connection do |
检查配置:
1 | mongify check db.config |
提示需要安装SQLServer的适配器
1 | /Users/mazhibin/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': Please install the sqlserver adapter: `gem install activerecord-sqlserver-adapter` (cannot load such file -- active_record/connection_adapters/sqlserver_adapter) (LoadError) |
安装一下:
1 | gem install activerecord-sqlserver-adapter |
再次检查还有错误:
1 | /Users/mazhibin/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/specification.rb:2284:in `raise_if_conflicts': Please install the sqlserver adapter: `gem install activerecord-sqlserver-adapter` (Unable to activate activerecord-sqlserver-adapter-4.2.15, because activerecord-3.2.22.4 conflicts with activerecord (~> 4.2.1)) (LoadError) |
看起来是版本冲突问题。
列出本地安装的ruby包:
1 | $ gem list |
估计是应为本地有一套3.x版本的activerecord库,所以导致冲突了,删除它:
1 | gem uninstall activemodel -v 3.2.22.4 |
再检查,提示
1 | /Users/mazhibin/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs': Could not find 'activerecord' (~> 3.2) - did find: [activerecord-4.2.7.1] (Gem::LoadError) |
日了狗。。。看来作者没测试过就是高风险啊。。。弃
参考资料
- [Mongify][Mongify]
- Unable to resolve dependencies: ubuntu · Issue #99 · anlek/mongify
- ruby - Unable to activate susy-2.1.1, because sass-3.2.17 conflicts with sass (~> 3.3.0) - Stack Overflow
[Mongify] :http://mongify.com/
如果觉得文章对你有帮助,就打赏杯咖啡钱呗😊