【问题标题】:converting mysql db to pg db将 mysql db 转换为 pg db
【发布时间】:2014-05-19 18:44:43
【问题描述】:

所以,我使用的是mysql2psql gem,我得到了以下代码:

mysql:
 hostname: localhost
 port: 3306
 socket: /tmp/mysql.sock
 username: root
 password: root
 database: hello_development

destination:
 # if file is given, output goes to file, else postgres
 file: 
 postgres:
  hostname: localhost
  port: 5432
  username: root
  password: root
  database: hello_development

# if tables is given, only the listed tables will be converted.  leave empty to convert all tables.
#tables:
#- table1
#- table2
# if exclude_tables is given, exclude the listed tables from the conversion.
#exclude_tables:
#- table3
#- table4


# if supress_data is true, only the schema definition will be exported/migrated, and not the data
supress_data: false

# if supress_ddl is true, only the data will be exported/imported, and not the schema
supress_ddl: false

# if force_truncate is true, forces a table truncate before table loading
force_truncate: false

不过,我有点困惑,至于如何转换我的所有表格,例如测试和生产也是如此。目前,看起来我只是在转换 hello_development。

请指教!

【问题讨论】:

    标签: mysql ruby-on-rails postgresql ruby-on-rails-4


    【解决方案1】:

    您正在指定要使用的数据库 - database: hello_development - 这就是它只在您的开发环境中运行的原因。您还需要为测试和生产环境创建 mysql2pgsql 的配置文件。

    过去曾使用过 mysql2pgsql,请记住,mysql 和 postgres 的工作方式之间可能存在很多差异 - 请确保您在开发环境之前已在开发环境中全面测试过您的应用程序在您的生产环境中运行此脚本。

    【讨论】:

      猜你喜欢
      • 2013-09-28
      • 2011-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-24
      • 2011-08-02
      • 2012-01-28
      相关资源
      最近更新 更多