ufront / ufront-orm

The Object Relational Mapper, allows easy, type-safe access to your database. Builds on Haxe's SPOD but adds macro powered relationships, validation and client side usage
MIT License
13 stars 4 forks source link

Updating tables without reseting the database #21

Closed tiagolr closed 9 years ago

tiagolr commented 9 years ago

Hey, soon I'm likely to change the model of my app, for e.g to add a new field to the user profile object.

How do you handle changes to the model when you already have a server and database in production? So far I've been deleting the database and starting fresh creating the tables, is there any way to ease this process in haxe/ufront-orm? Or i should just manually enter the SQL commands?

Thanks.

jasononeil commented 9 years ago

Currently the best option (which I use myself) is to use the ufront-ufadmin library. This includes the dbadmin haxelib, and will display a list of tables and show you any differences between the schema, and let you make those changes to the database tables.

ufadmin

Including UFAdmin is fairly simple, there is an example in the hello world repo: https://github.com/ufront/hello/blob/master/src/app/controller/HomeController.hx#L14

If that's not the solution you are hoping for, at the moment your only other option is manual SQL.

You can follow issue #12 if you want to see the plan for a more full-featured database migration solution, which I'm pretty eager to use myself once I (or someone else!) has time to make it.

tiagolr commented 9 years ago

Thanks, for now I'm using sqlite DB browser to rename tables or add new columns etc.. In the future i may look into ufront-orm database migration and contribute as it seems very useful.