Created Suppliers
This commit is contained in:
55
database/migrations/2021_12_17_162247_create_suppliers.php
Normal file
55
database/migrations/2021_12_17_162247_create_suppliers.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateSuppliers extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('suppliers', function (Blueprint $table) {
|
||||
$table->integer('id',TRUE)->unsigned();
|
||||
$table->boolean('active');
|
||||
$table->string('name')->unique();
|
||||
$table->string('address1');
|
||||
$table->string('address2')->nullable();
|
||||
$table->string('city',64);
|
||||
$table->string('state',32);
|
||||
$table->string('postcode',8);
|
||||
});
|
||||
|
||||
Schema::create('supplier_details', function (Blueprint $table) {
|
||||
$table->integer('id',TRUE)->unsigned();
|
||||
$table->timestamps();
|
||||
$table->text('notes')->nullable();
|
||||
$table->string('accounts')->nullable();
|
||||
$table->string('support')->nullable();
|
||||
$table->string('payments')->nullable();
|
||||
|
||||
$table->integer('supplier_id')->unsigned();
|
||||
$table->integer('site_id');
|
||||
|
||||
$table->unique(['supplier_id','site_id']);
|
||||
|
||||
$table->foreign(['supplier_id'])->references(['id'])->on('suppliers');
|
||||
$table->foreign(['site_id'])->references(['id'])->on('sites');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('supplier_details');
|
||||
Schema::dropIfExists('suppliers');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user