migrate


  • (PHP) Add column to table in Laravel

    Create migration in console: [php] php artisan make:migration add_mycolumn_to_mytable [/php] Use Schema::table() to access existing table (instead of Schema::create() for creating new tables) [php] public function up() { Schema::table(‘mytable’, function($table) { $table->text(‘mycolumn’); }); } public function down() { Schema::table(‘mytable’, function($table) { $table->dropColumn(‘mycolumn’); }); } [/php] Then run migrations: [php] php artisan migrate [/php]