如果在rails中我运行db:schema:load,并且架构加载,直到它表示"要迁移的租户列表似乎是空的&#34 ;? 有什么方法可以解决这个问题?
就像在这里一样(对不起,我无法更好地格式化):
...
- create_table("用户",{:force =>:cascade})
- > 0.4490s- create_table(" web_migrations",{:id => false,:force =>:cascade})
- > 0.6138s- initialize_schema_migrations_table()
- > 0.0332s[警告] - 要迁移的租户列表似乎为空。这可能意味着一些事情:
1. You may not have created any, in which case you can ignore this message 2. You've run `apartment:migrate` directly without loading the Rails environment * `apartment:migrate` is now deprecated. Tenants will automatically be migrated with `db:migrate` Note that your tenants currently haven't been migrated. You'll need to run `db:migrate` to rectify this.
我注意到db:schema:load运行两次? 它开始很好:
- create_table(" asset_status",{:force =>:cascade})
- > 0.5029s- create_table(" asset_type",{:force =>:cascade})
- > 0.2904s[继续...]
- create_table(" web_migrations",{:id => false,:force =>:cascade})
- > 0.3347s- initialize_schema_migrations_table() - > 1.1729s
然后再次:
- create_table(" asset_status",{:force =>:cascade})
- > 0.6400s- create_table(" asset_type",{:force =>:cascade})
- > 0.5805s[继续...]
是不是错了?
答案 0 :(得分:3)
以防将来对某人有所帮助,如果没有其他解决方案,则可以使用单租户迁移。
运行DB=tenant_name rake db:migrate
这将为特定租户迁移数据库。