Giter Club home page Giter Club logo

Comments (7)

ryanbrunner avatar ryanbrunner commented on May 27, 2024

Even if it wasn't looking for a hardcoded schema.rb file, schema.sql doesn't work, as the Rails dumper doesn't play too well with multiple schemas the last time I tried it. It's probably fixable, but it would involve some modifications of some rake tasks, particularly db:schema:dump and db:schema:load. If you want to take a look, we'd welcome a pull request - we use hstore as well and have a few workarounds to get around being unable to dump a sql schema.

from apartment.

rurounijones avatar rurounijones commented on May 27, 2024

Do you have the workaround documented anywhere? I am not sure i will have time to fix this for a while so it may come in useful.

from apartment.

l3x4 avatar l3x4 commented on May 27, 2024

Also I'd like to notice that using schema.rb doesn't solve the problem if the database has complex structure with triggers and functions. These are just silently ommited in the schema.rb

As a workaround it might be possible to run all the migrations against the new schema on create instead...
Yes, it might take much longer then loading schema.rb, but it should preserve the DB code.
So it would be great to have such an option.

from apartment.

bradrobertson avatar bradrobertson commented on May 27, 2024

i dont' think we'd recommend this type of behaviour. Migrations are not meant to be the definitive source for your db, the schema is. Migrations become unreliable on larger projects as refactorings take place. They're not even guaranteed to run start to end at that point. We often clean up our migration directory as it piles up.

Yes we're limited with schema.rb. We'll have to discuss some solutions for supporting things like contraints that may be added through migrations.

from apartment.

l3x4 avatar l3x4 commented on May 27, 2024

Generating and using db/structure.sql can help, but I don't know if it can be easily applied to some specified schema other then the one used at the dump time. I finally used the split-migration approach applying the tenant part of the migrations with ActiveRecord::Migrator every time a tenant gets created or needs a schema update.

from apartment.

brendon avatar brendon commented on May 27, 2024

I think I just read in the latest 3.2.14 release that they've fixed the dumping?

from apartment.

bradrobertson avatar bradrobertson commented on May 27, 2024

Ya I guess you're referring to this in the changelog:

Resets the postgres search path in the structure.sql after the structure is dumped in order to find schema_migrations table when multiples schemas are used. Fixes #9796.

Might be worth a look into it. We could probably allow a config option for the dump type (ie :sql, or :ruby) or something to that affect.

from apartment.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.