File: /var/www/admin.javaapp.co.uk/database/migrations/2023_02_02_122040_create_groups_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('groups', function (Blueprint $table) {
$table->id();
$table->string('group_name')->default('');
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('cascade');
$table->integer('group_code')->default(0);
$table->string('group_profile')->default('');
$table->tinyInteger('is_active')->default(0)->comment('1 = active, 0 = inactive');
$table->unsignedInteger('created_at')->default(0);
$table->unsignedInteger('updated_at')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('groups', function (Blueprint $table) {
$table->dropConstrainedForeignId('created_by');
});
Schema::dropIfExists('groups');
}
};