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']);


// column list

// 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

No comments:

Post a comment