fix migration errors

This commit is contained in:
Mohit Panjwani
2020-05-13 12:47:06 +05:30
parent c7ce8c87dd
commit 4ca574c581
2 changed files with 18 additions and 14 deletions

View File

@ -13,13 +13,15 @@ class CreateUnitsTable extends Migration
*/ */
public function up() public function up()
{ {
Schema::create('units', function (Blueprint $table) { if (!Schema::hasTable('units')) {
$table->increments('id'); Schema::create('units', function (Blueprint $table) {
$table->string('name'); $table->increments('id');
$table->integer('company_id')->unsigned()->nullable(); $table->string('name');
$table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade'); $table->integer('company_id')->unsigned()->nullable();
$table->timestamps(); $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
}); $table->timestamps();
});
}
} }
/** /**

View File

@ -13,13 +13,15 @@ class CreatePaymentMethodsTable extends Migration
*/ */
public function up() public function up()
{ {
Schema::create('payment_methods', function (Blueprint $table) { if (!Schema::hasTable('payment_methods')) {
$table->increments('id'); Schema::create('payment_methods', function (Blueprint $table) {
$table->string('name'); $table->increments('id');
$table->integer('company_id')->unsigned()->nullable(); $table->string('name');
$table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade'); $table->integer('company_id')->unsigned()->nullable();
$table->timestamps(); $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
}); $table->timestamps();
});
}
} }
/** /**