@mikewink how about this one,,, I tried what you suggested but its not working on my end.
public function up()
{
Schema::create('products', function (Blueprint $table) {
$table->id();
$table->bigInteger('product_type_id')->unsigned()->nullable(true);
$table->string('name')->nullable(false);
$table->string('description');
$table->float('price')->nullable(false);
$table->float('old_price');
$table->string('status')->comment('active, inactive, removed');
$table->float('tax');
$table->float('unit_price');
$table->float('taxable_amount');
$table->float('taxable_total');
$table->dateTime('deleted_at');
$table->timestamps();
});
Schema::table('products', function (Blueprint $table) {
$table->foreign('product_type_id')->references('id')->on('product_type');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::disableForeignKeyConstraints();
Schema::dropIfExists('products');
}
after running this command Schema::disableForeignKeyConstraints();
I got this error
Migrating: 2022_06_03_135557_products
Illuminate\Database\QueryException
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'products' already exists (SQL: create table `products` (`id` bigint unsigned not null auto_increment primary key, `product_type_id` bigint unsigned null, `name` varchar(191) not null, `description` varchar(191) not null, `price` double(8, 2) not null, `old_price` double(8, 2) not null, `status` varchar(191) not null comment 'active, inactive, removed', `tax` double(8, 2) not null, `unit_price` double(8, 2) not null, `taxable_amount` double(8, 2) not null, `taxable_total` double(8, 2) not null, `deleted_at` datetime not null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')