-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding in new db.setup task to run db.create and db.migrate together (#…
…361) * Adding in new db.setup task to run db.create and db.migrate together. Fixes #359 * Adding db.setup to integration specs
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class Db::Setup < LuckyCli::Task | ||
summary "Runs a few tasks for setting up your database" | ||
|
||
def initialize(@quiet : Bool = false) | ||
end | ||
|
||
def help_message | ||
<<-TEXT | ||
#{summary} | ||
This task will run the following: | ||
* db.create - Create the database from config/database.cr | ||
* db.migrate - Migrate all pending migrations from db/migrations/ | ||
Examples: | ||
lucky db.setup | ||
LUCKY_ENV=test lucky db.setup # Setup test database | ||
TEXT | ||
end | ||
|
||
def call | ||
Avram::Migrator.run do | ||
Avram::Migrator::Runner.create_db(@quiet) | ||
Avram::Migrator::Runner.new(@quiet).run_pending_migrations | ||
end | ||
end | ||
end |