@lovertohelp
You probably have a couple of options.
create a new migration to add the new column and run the migration only
update the original migration - run migration
more manual way that might be the easiestfor your use is;
do the db changes in cpanel/phpmyadmin directly
but update the migration file locally as well so that your local is in sync for the future / tests
Example of the new migration
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->integer('created_by')->unsigned()->nullable();
});
}
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('created_by');
});
}
The best way is to create a new migration and add the needed fields.
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->foreignId('society_id')->nullable()->after('remember_token')->references('id')->on('societies');
$table->boolean('admin')->after('society_id')->default(false)->index();
$table->boolean('superadmin')->after('admin')->default(false);
$table->boolean('active')->after('superadmin')->default(true)->index();
});
}
now site is on host . can you show way without php artisan migrate
i want add one column in 1 table without destroy data on database.
i afraid that other data remove from database .