Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample Implementation #7

Open
dougwinsby opened this issue Jun 10, 2020 · 0 comments
Open

Sample Implementation #7

dougwinsby opened this issue Jun 10, 2020 · 0 comments

Comments

@dougwinsby
Copy link

I really like this migration library (and I've tried several). My only complaint was getting started. I thought it might help others to share the approach I took.

I used a x.xx database versioning approach, but took the extra step to "minify" the script before including it in the migration. This allowed simple formatting and comment changes to be made (after release) without causing checksum errors.

Each migration step is a variable (with all steps of a major version defined inside a variable group for easy code folding).

I wanted to show the current database version with a before and after version if migrations were applied. Something like this:

DB Version: 2.01 (migrated from 1.03 to 2.01)

But I didn't want to perform an Info() call twice just to get the last version each time (it returns all migrations from the database).

I also wanted to provide a detailed error message if a migration failed. I do this with the very convenient info channel feature.

Here is the what I ended up with:

https://gist.github.com/dougwinsby/48db699dadaee6f9d8e80ea692bb4c79

Hope it helps someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant