-
Notifications
You must be signed in to change notification settings - Fork 64
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
Add lucky db.migrations.status CLI task #135
Add lucky db.migrations.status CLI task #135
Conversation
- Adds a new CLI task lucky db.migrations.status - Exposes a formerly private method on Avram::Migrator::Runner to create the migrations table if it doesn't exist
b3e308a
to
b8351ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for your contribution! It looks fantastic. Just a few minor suggestions before we merge this in
Could you run this task somewhere here in script/test
Line 21 in 428158f
$COMPOSE lucky db.migrate.one |
That works like our "integration test" to make sure things don't fail in unexpected ways.
src/avram/migrator/runner.cr
Outdated
@@ -137,6 +137,12 @@ class Avram::Migrator::Runner | |||
end | |||
end | |||
|
|||
def setup_migration_tracking_tables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make this a class method instead? I think that might make more sense since it doesn't need an instance variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in f5dd3b1
Note that I also pulled up create_table_for_tracking_migrations
into a private class method, since it too does not depend on instance variables but is called by setup_migration_tracking_tables
private def migration_statuses | ||
migrations.map do |migration| | ||
status = if migration.new.migrated? | ||
"Migrated".colorize(:green) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the yellow and green clash a bit. Could you leave this the default color?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 69e3111
@paulcsmith This is ready for another look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! 🎉
👋
This is my first attempt at a contribution to Lucky and pretty much my first time writing Crystal code, so any / all feedback is super appreciated.
I took at a stab at adding the
lucky db.migrations.status
task from #126A few things to note:
shell-table
shard as a dependency to help format the output.shell-table
shard is pointing to a branch on the fork at luckyframework. I didn't have a good reason to do this other than that's the version lucky itself is using (https://github.com/luckyframework/lucky/blob/32db2b499227541ab43b5927bf88e1b95a3e53d8/shard.yml#L47-L49). Happy to update this.Example output:
Thanks!