Mysqldump, writing in postgresql format
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 11 年前 | ||
| 10 年前 | ||
| 6 年前 | ||
| 11 年前 | ||
| 10 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 13 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 |
以下内容由 AI 翻译,如有问题请 点此提交 issue 反馈
mysql-to-postgres - MySQL到PostgreSQL数据转换
支持MRI或jruby。在master分支上支持的最低Ruby版本是2.1.7,下个版本也将有相同的要求。
通过稍微修改rails的database.yml配置,你可以将mysql-to-postgres集成到项目中。
安装
目前失败,参见 #81...
通过RubyGems
gem install mysqltopostgres
从源代码安装
git clone https://github.com/maxlapshin/mysql2postgres.git
cd mysql2postgres
bundle install
gem build mysqltopostgres.gemspec
sudo gem install mysqltopostgres-0.3.1.gem
示例配置
配置文件采用YAML格式编写,并作为命令行的第一个参数传递。
default: &default
adapter: jdbcpostgresql
encoding: unicode
pool: 4
username: terrapotamus
password: default
host: 127.0.0.1
development: &development
<<: *default
database: default_development
test: &test
<<: *default
database: default_test
production: &production
<<: *default
database: default_production
mysql_data_source: &pii
host: localhost
port: 3306
socket: /tmp/mysqld.sock
username: username
password: default
database: awesome_possum
mysql2psql:
mysql:
<<: *pii
destination:
production:
<<: *production
test:
<<: *test
development:
<<: *development
tables:
- countries
- samples
- universes
- variable_groups
- variables
- sample_variables
# 如果suppress_data为true,只导出/迁移架构定义,不导出数据
suppress_data: false
# 如果suppress_ddl为true,只导入/导出数据,不处理架构
suppress_ddl: true
# 如果force_truncate为true,在加载表之前强制清空表
force_truncate: false
preserve_order: true
remove_dump_file: true
dump_file_directory: /tmp
report_status: json # false, json, xml
# 如果clear_schema为true,转换前会重新创建public模式
# 如果同时设置clear_schema和suppress_ddl,导入会失败。
clear_schema: false
请注意,如果MySQL的主机未定义(nil)或者其值为'localhost',连接将会使用套接字。
测试
许可证
授权于MIT许可。