2
在使用postgres模式(即schema_name.users)的應用程序上運行rake db:schema:dump時,它看起來只是爲db用戶的搜索路徑中的第一個模式轉儲表。有沒有一種方法可以包含來自多個模式的表格?在rake數據庫中包含多個postgres模式:schema:dump?
以不同的方式陳述問題:
createdb myapp
psql myapp -U postgres -c "create table stuff"
#=> creates table "stuff" in the public schema
psql myapp -U postgres -c "create schema specific_thing"
psql myapp -U postgres -c 'create table "specific_thing".users(id int)'
createuser -U postgres -S -D -R special_user
psql myapp -U postgres -c "grant all on schema specific_thing to special_user"
psql myapp -U postgres -c "ALTER USER special_user SET search_path TO specific_thing,public"
在database.yml:
...
development:
adapter: postgresql
database: stuff
username: special_user
password:
host: localhost
...
運行:rake db:schema:dump
僅從specific_thing
模式轉儲users
talbe,而忽略公共架構的一切。
你能轉儲多個模式嗎? –