laravel cudzí kľúč
Schema::table('posts', function (Blueprint $table) {
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
});
OR
Schema::table('posts', function (Blueprint $table) {
$table->foreignId('user_id')->constrained();
});
php remeselník vykonať migráciu
php artisan make:migration create_users_table
laravel urobiť model s migráciou a regulátorom
php artisan make:model Todo -mcr
vrátenie migrácie
php artisan migrate:rollback
pridať stĺpec v laravel migrácie
php artisan make:migration add_paid_to_users_table --table=users
návrat migrácie Laravelu
To rollback one step:
php artisan migrate:rollback
To rollback multiple steps:
php artisan migrate:rollback --step=[x]
To drop all tables and reload all migrations:
php artisan migrate:fresh