Posts

Showing posts from March, 2021

Laravel

Permasalahan mysql laravel:  alter user 'root'@'localhost' identified with mysql_native_password by 'abc@123'; When u done with migration, but want to add column: Create a migration file using cli command: php artisan make:migration add_paid_to_users_table --table=users A file will be created in the  migrations  folder, open it in an editor. Add to the function up(): Schema::table( 'users' , function ( Blueprint $table ) { // Create new column // You probably want to make the new column nullable $table ->integer( 'paid' )->nullable()->after( 'status' ); } Add to the function down(), this will run in case migration fails for some reasons: $table->dropColumn('paid'); Run migration using cli command: php artisan migrate https://stackoverflow.com/questions/16791613/add-a-new-column-to-existing-table-in-a-migration