Tuesday, 19 February 2019

Laravel migration, caches

// Migration 101

//  Make seeder
php artisan make:seeder UsersTableSeeder

//Once you have written your seeder, you may need to regenerate Composer's autoloader using the dump-autoload command:
composer dump-autoload

// Clear config chaces for new db connection specified in config/database.php
php artisan config:clear

// Migrate:
php artisan migrate

// Run seeder
php artisan db:seed


// If generated new JWT or application token in .env file, clear cache to have effect
php artisan cache:clear (clear cache and creates new cache)

// Add primary key of two columns
$table->primary(['post_id', 'tag_id']);



https://laravel.com/docs/5.7/seeding
https://stackoverflow.com/questions/45224028/change-laravel-db-connection
https://tutsforweb.com/laravel-migration-database-seeding/

// column list
https://laravel.com/docs/5.7/migrations

// MYSQL unqiue key can not index on text columns without length
// unqiue key will index a column but impossible on text column w/o length
https://stackoverflow.com/questions/1827063/mysql-error-key-specification-without-a-key-length

No comments:

Post a comment