Creating a multi-tenant application using PostgreSQL's schemas and Rails

前端 未结 3 2115
攒了一身酷
攒了一身酷 2021-01-29 17:53

Stuff I\'ve already figured out

I\'m learning how to create a multi-tenant application in Rails that serves data from different schemas based on what domain or subdomai

3条回答
  •  迷失自我
    2021-01-29 18:44

    Change line 38 to:

    conn.schema_search_path = "#{schema_name}, #{old_search_path}"
    

    I presume that postgres is trying to lookup existing table names when loading schema.rb and since you've set the search_path to only contain the new schema, it fails. This of course, is presuming you still have the public schema in your database.

    Hope that helps.

提交回复
热议问题