How to use H2 as embedded database in Postgres-compat mode, from jruby/rails

自古美人都是妖i 提交于 2019-12-06 10:48:55

问题


I'd like to launch a jruby/rails app to use Postgres. But I'd like to use H2 in Postgres compatibility mode when running in development and test.

Its no problem bringing up the app in H2, or in postgresql, but how do I configure to run the postgresql adaptor, using an embedded H2 database?

For example: something like this:

database.yml

    development:
    #  adapter: jdbch2
    #  database: db/development/database
      adapter: postgresql
      encoding: unicode
      database: database
    #  driver: org.h2.Driver
      url: jdbc:h2:~/db/development;MODE=PostgreSQL

    test:
    ...

Gemfile:

...
gem 'activerecord-jdbch2-adapter'
#gem 'jdbc-h2'
gem 'activerecord-jdbcpostgresql-adapter'
...

来源:https://stackoverflow.com/questions/15487818/how-to-use-h2-as-embedded-database-in-postgres-compat-mode-from-jruby-rails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!