Welcome Guest, Not a member yet? Register   Sign In
Why does DataMapper OverZealous Edition not create tables?
#1

[eluser]Tom Martin[/eluser]
Just been playing around with DataMapper OverZealous Edition and I was surprised that it does not automatically create and migrate tables when the models are updated, this is how the ruby datamapper works. Is this type of functionality something which could be added, or is there a reason why it can't be done?

Do any of the CI ORM/Active Record libraries automatically create and migrate tables when models change?
#2

[eluser]WanWizard[/eluser]
Currently Datamapper requires the data structure to be present. The model doesn't contain any information about the table, this information is loaded from the database, or from the cache if enabled. And because of that, automatic migrations aren't possible.

Adding an automatic system will require continues checks of the current state of the database table, which will slow Datamapper down considerably. It might be possible to add migrations as an extension, for example based on Phil Sturgeon's migrations library. Alternatively the caching system can be rewritten to provide this feature, but that will require quite some work.

Please create a feature request at http://bitbucket.org/wanwizard/datamapper/issues, and add a link to this thead.
#3

[eluser]Tom Martin[/eluser]
Would it need to continuously check, could it just check if a migration method was called? So if you'd made any changes to your models you could call the migration method which would do any database jazz and migrate the data?
#4

[eluser]WanWizard[/eluser]
if you want automatic, then continuous checks are required. If you're just looking for a 'migrations' feature, then an extension would be the best thing to use.
#5

[eluser]Unknown[/eluser]
When you say 'migrations', do you mean creating the tables from the models? I want to do that if possible? Is there an extension, and if so can you point me to it?
#6

[eluser]Tom Martin[/eluser]
@slugmandrew: Yes I mean creating the tables from the models and update the tables if the models change.

When I say automatic I mean handled by CodeIgniter, not checked on every database read. It would probably be triggered by a upgrade_scheme command or something similar.
#7

[eluser]WanWizard[/eluser]
If you want a 'migrations' feature in Datamapper, please add a feature request to http://bitbucket.org/wanwizard/datamapper/issues.




Theme © iAndrew 2016 - Forum software by © MyBB