masonite-orm
with your applications python craft
file.up
method and a down
method. You should perform your schema logic in the up
method and then reverse what you did in the down
method.name_of_migration
create_users_table
--create {name}
--create users
--table {name}
--table users
--directory=databases/migrations
--directory app/databases/migrations
up
method. Each group of migrations that are ran will create a batch number and store information in the migrations
table. The batch number will allow groups of migrations to be rolled back if needed.--migration {name}
--migration create_users_table
--connection {name}
--connection staging
--show
--show
--force
APP_ENV
environment variable is set to production
then a prompt will ask you if you really want to migrate as a safety check. Using this flag will ignore the prompt and migrate anyway--force
--directory=databases/migrations
--directory app/databases/migrations
down
method on each migration file in reverse order to "undo" the migration changes that were previously ran.--migration {name}
--migration create_users_table
--connection {name}
--connection staging
--show
--show
--directory=databases/migrations
--directory app/databases/migrations
--migration {name}
--migration create_users_table
--connection {name}
--connection staging
--directory=databases/migrations
--directory app/databases/migrations
--migration {name}
--migration create_users_table
--connection {name}
--connection staging
--seed
--seed
--directory=databases/migrations
--directory app/databases/migrations
--seed-directory=databases/seeds
--seed-directory=databases/seeds
--connection {name}
--connection staging
--directory=databases/migrations
--directory app/databases/migrations
{name}
User
--migration {name}
--migration create_users_table
--migration
--migration
--seed
--seed
--create
--create
--table
--table
--pep
--pep
--directory=app
--pep
--migrations-directory=databases/migrations
migration
option.--migrations-directory=app/migrations
--seeders-directory=databases/seeds
seed
option.--seeders-directory=app/seeds
model:docstring
command. This command will output an example docstring of all your tables columns and their data types so you can put it on your model for reference. When you make schema changes you can rerun this command to get the updated schema.--type-hints
option you can find below.{table}
User
--type-hints
--type-hints
--connection {name}
--connection staging
{name}
UserObserver
--model
--model User
--directory=app/observers
--directory app/databases
{table}
users
--directory=databases/seeds
--directory app/seeds
--connection {name}
--connection staging
--dry
--dry
--table
--table users
--directory=databases/seeds
--directory app/seeds