Lucky Logo


Tasks are used to run some code that sits outside of your main application. When you need to add a task, you’ll place it in the tasks folder. To see a list of the available tasks in your application, use lucky --help.

You can think of a Luck Task just like a Rake task in Ruby, npm script for Node, or Mix Task for Elixir.

To run a task, you just run

lucky name.of.task [options]

#Built-in Tasks

By default, Lucky has a few tasks already built in that you may find really handy while developing your application. These are the ones that you get by default.

# Generated with lucky --help
lucky db.create            - Create the database
lucky db.drop              - Drop the database
lucky db.migrate           - Migrate the database
lucky       - Run the next pending migration
lucky db.migrations.status - Print the current status of migrations
lucky db.redo              - Rollback then run the last migration
lucky db.rollback          - Rollback the last migration
lucky db.rollback_all      - Rollback all migrations
lucky db.rollback_to       - Rollback to a specific migration
lucky db.verify_connection - Verify connection to postgres
lucky gen.action           - Generate a new action
lucky gen.migration        - Generate a new migration
lucky gen.model            - Generate a model, query, and form
lucky gen.secret_key       - Generate a new secret key
lucky routes               - Show all the routes for the app
lucky watch                - Start and recompile project when files change