Skip to content

Instantly share code, notes, and snippets.

@ajdeguzman
Forked from robinmitra/laravel-generators.sh
Last active August 29, 2015 14:08
Show Gist options
  • Save ajdeguzman/0e7a3e16eae87279726d to your computer and use it in GitHub Desktop.
Save ajdeguzman/0e7a3e16eae87279726d to your computer and use it in GitHub Desktop.
## Migration
# Create a migration to create a table named 'posts'
php artisan generate:migration create_posts_table
# Create a migration to add a field named 'user_id' to the 'posts' table
php artisan generate:migration add_user_id_to_posts_table
# Create a migration to remove the 'user_id' field we just created
php artisan generate:reomve_user_id_from_posts_table
# Create a migration to delete the 'posts' table we just created
php artisan generate:migration delete_posts_table
# Create a migration to create a table named 'posts' and also generate the schema for a number of fields
php artisan generate:migration create_posts_table --fields="title:string, body:text, age:integer:nullable:default(18), username:string(30):unique"
# Create a migration to remove the 'age' field we just created
php artisan generate:reomve_age_from_posts_table --fields="age"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment