Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

schema.rb vs. migrations #2

Closed
ashes999 opened this issue Feb 3, 2015 · 6 comments
Closed

schema.rb vs. migrations #2

ashes999 opened this issue Feb 3, 2015 · 6 comments

Comments

@ashes999
Copy link

ashes999 commented Feb 3, 2015

Hi,

The docs mention that you can specify migrate: true to use migrations instead of the pre-generated schema.rb.

I'm a bit new to Rails (again). What's the trade-off here? How would I know which one to choose?

@haslinger
Copy link

It's possibly slower to run, especially when you have lots of migrations, compared to one schema loading. If your migrations are broken, you obviously can't use them (which is the case, if you didn't keep them consistent).

@mknapik
Copy link

mknapik commented Aug 18, 2015

To solve the this run MemoryTestFix::SchemaLoader.init_schema after Spring fork.

Create config/initializers/spring.rb if does not exist:

Spring.after_fork do
  MemoryTestFix::SchemaLoader.init_schema
end

@mvz
Copy link
Owner

mvz commented Aug 20, 2015

@mknapik I think you meant to comment on #3? In any case, thanks for the tip, I'll see if I can incorporate that in memory_test_fix so people don't have to add an initializer.

@mknapik
Copy link

mknapik commented Aug 20, 2015

@mvz Yes, not sure why it ended up here :-)

@mvz
Copy link
Owner

mvz commented Sep 7, 2015

@ashes999 some reasons for using migrate: true could be to help make sure your migrations don't break due to changes in the code elsewhere (whether this is useful depends on your use-case), or to make some seeding data be available. If those reasons don't apply, keeping it at the default is probably faster.

TL;DR: Use the default unless there's a clear reason not to. You can always switch later.

@mvz
Copy link
Owner

mvz commented Feb 23, 2016

I moved this Q&A to the Wiki.

@mvz mvz closed this as completed Feb 23, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants