eaigner / hood

Database agnostic ORM for Go
MIT License
710 stars 52 forks source link

Run migration in application. #44

Closed coocood closed 6 years ago

coocood commented 11 years ago

The current migration implementation seems not easy to use.

I want migration to be executed in the application.

We can provide some APIs to execute a sequence of migration and associate each migration command with a version number.

the schema after each version of migration can be stored in local file, and will be used to check if new migration is added.

And I also want database level migration, like create database, rename database.

eaigner commented 11 years ago

Automatic migration execution is a sure highway to hell, especially if you have multiple servers.

Anyway, I don't have the time to implement this - I only wrote it because there was no usable ORM - and I need a production ready ORM yesterday.

What do you mean by

the schema after each version of migration can be stored in local file ...?

The schema is already stored in a local file called schema.go, that's auto generated, reflects the current DB state and can be directly included in the project! The current migration state is stored in the DB inside the migrations table with the current migrations timestamp to determine the correct migrations on db:migrate resp. db:rollback.

I don't think it get's any easier than typing hood db:migrate, because that's all that you have to do atm.

I'll mark this as help-wanted.

coocood commented 11 years ago

I'm sorry, I didn't use your migration tool, I didn't know how it works.

I'm currently calling migration methods in application.

I mean save every history version of schema, like application version, without timestamp.

So added column and added table will be detected and can be executed automatically.