fix migrations

This commit is contained in:
mahdi purHosseini
2023-09-17 13:39:48 +03:30
parent b2fcd1ab69
commit 7a3fd3a13f
26 changed files with 1130 additions and 295 deletions
@@ -1,37 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePackagesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('packages', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('unique_id');
$table->text('note')->nullable();
$table->enum('verified', ['Verified', 'NotVerified']);
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('packages');
}
}
@@ -1,38 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateItemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('items', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('size');
$table->string('unique_id');
$table->string('specific');
$table->text('note')->nullable();
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('items');
}
}
@@ -1,35 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTablePackPackage extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pack_package', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('pack_id');
$table->foreign('pack_id')->references('id')->on('packes');
$table->unsignedBigInteger('package_id');
$table->foreign('package_id')->references('id')->on('packages');
// $table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pack_package');
}
}
@@ -16,6 +16,9 @@ class CreateMedicalCentersTable extends Migration
Schema::create('medical_centers', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->text('address')->nullable();
$table->string('phone_number')->nullable();
$table->integer('city_id')->nullable();
$table->timestamps();
});
}
@@ -20,7 +20,9 @@ class CreateTestTypesTable extends Migration
$table->string('bar_code');
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
$table->enum('device_label', ['AutoclaveID', 'WasherID', 'SterilizerID', 'WasherMachineID', 'SealMachineID', 'PatientID', 'Set/PackID', 'MDID', 'ORID', 'InstrumentID', 'ID', 'PersonalID']);
$table->timestamps();
$table->softDeletes();
});
}
@@ -15,15 +15,13 @@ class CreateTestResultsTable extends Migration
{
Schema::create('test_results', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('info');
$table->string('cycle_number');
$table->string('info')->nullable();
$table->string('cycle_number')->nullable();
$table->date('date')->nullable();
$table->string('result');
$table->text('description');
$table->smallInteger('verified');
$table->string('device_id');
$table->string('device_label');
$table->integer('autoclave_id');
$table->enum('result', ['Accept', 'Reject']);
$table->text('description')->nullable();
$table->enum('verified', ['Verified', 'NotVerified', 'None']);
$table->string('device_id')->nullable();
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
$table->unsignedBigInteger('test_type_id');
@@ -15,14 +15,15 @@ class CreateInputsTable extends Migration
{
Schema::create('inputs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('type');
$table->string('name')->nullable();
$table->enum('type', ['Text', 'Form', 'Checkbox', 'Select', 'Time', 'Temperature', 'Radiobutton', 'Switch', 'Range', 'Date', 'Pressure']);
$table->unsignedBigInteger('test_type_id');
$table->foreign('test_type_id')->references('id')->on('test_types');
$table->unsignedBigInteger('parent_id')->nullable();
$table->foreign('parent_id')->references('id')->on('inputs');
$table->string('size');
$table->string('value');
$table->string('size')->nullable();
$table->string('value')->nullable();
$table->tinyInteger('require_scanner')->nullable();
$table->timestamps();
});
}
@@ -15,13 +15,13 @@ class CreateInputValuesTable extends Migration
{
Schema::create('input_values', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('value');
$table->string('value')->nullable();
$table->unsignedBigInteger('option_id')->nullable();;
$table->foreign('option_id')->references('id')->on('options');
$table->unsignedBigInteger('input_id');
$table->foreign('input_id')->references('id')->on('inputs');
$table->unsignedBigInteger('test_result_id');
$table->foreign('test_result_id')->references('id')->on('test_results');
$table->unsignedBigInteger('option_id');
$table->foreign('option_id')->references('id')->on('options');
$table->timestamps();
});
}
@@ -16,11 +16,13 @@ class CreatePackagesTable extends Migration
Schema::create('packages', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('unique_id');
$table->string('unique_id')->nullable();
$table->text('note')->nullable();
$table->enum('verified', ['Verified', 'NotVerified']);
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
$table->string('bar_code')->nullable();
$table->string('qr_code')->nullable();
$table->timestamps();
});
}
@@ -17,7 +17,7 @@ class CreateItemsTable extends Migration
$table->bigIncrements('id');
$table->string('name');
$table->string('size');
$table->string('unique_id');
$table->string('unique_id')->nullable();
$table->string('specific');
$table->text('note')->nullable();
$table->unsignedBigInteger('user_id');
@@ -19,7 +19,7 @@ class CreateItemPackageTable extends Migration
$table->foreign('item_id')->references('id')->on('items');
$table->unsignedBigInteger('package_id');
$table->foreign('package_id')->references('id')->on('packages');
// $table->timestamps();
$table->integer('count')->default(1);
});
}
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTablePackes extends Migration
class CreateLabelsTable extends Migration
{
/**
* Run the migrations.
@@ -13,17 +13,19 @@ class CreateTablePackes extends Migration
*/
public function up()
{
Schema::create('packes', function (Blueprint $table) {
Schema::create('labels', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name')->nullable();
$table->date('sterile_date')->nullable();
$table->date('expire_date')->nullable();
$table->string('sterilizer_id');
$table->string('cycle_number');
$table->string('lot_number');
$table->string('department');
$table->string('department')->nullable();
$table->text('note')->nullable();
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
$table->unsignedBigInteger('package_id')->nullable();
$table->timestamps();
});
}
@@ -35,6 +37,6 @@ class CreateTablePackes extends Migration
*/
public function down()
{
Schema::dropIfExists('packes');
Schema::dropIfExists('labels');
}
}
@@ -15,7 +15,7 @@ class CreateCyclesTable extends Migration
{
Schema::create('cycles', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('unique_id')->nullable();
$table->date('date');
$table->string('sterilizer_id');
$table->string('cycle_number');
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTableCyclePack extends Migration
class CreateCycleLabelTable extends Migration
{
/**
* Run the migrations.
@@ -13,12 +13,13 @@ class CreateTableCyclePack extends Migration
*/
public function up()
{
Schema::create('cycle_pack', function (Blueprint $table) {
Schema::create('cycle_label', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('pack_id');
$table->foreign('pack_id')->references('id')->on('packes');
$table->unsignedBigInteger('label_id');
$table->foreign('label_id')->references('id')->on('labels');
$table->unsignedBigInteger('cycle_id');
$table->foreign('cycle_id')->references('id')->on('cycles');
$table->integer('count')->default(1);
$table->timestamps();
});
}
@@ -30,6 +31,6 @@ class CreateTableCyclePack extends Migration
*/
public function down()
{
Schema::dropIfExists('cycle_pack');
Schema::dropIfExists('cycle_label');
}
}
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTableCyclePack extends Migration
class CreateMessagesTable extends Migration
{
/**
* Run the migrations.
@@ -13,13 +13,15 @@ class CreateTableCyclePack extends Migration
*/
public function up()
{
Schema::create('cycle_pack', function (Blueprint $table) {
Schema::create('messages', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('pack_id');
$table->foreign('pack_id')->references('id')->on('packes');
$table->unsignedBigInteger('cycle_id');
$table->foreign('cycle_id')->references('id')->on('cycles');
$table->string('title');
$table->text('text');
$table->integer('sender_user_id')->nullable();
$table->integer('recipient_user_id')->nullable();
$table->enum('status', ['Read', 'UnRead']);
$table->timestamps();
$table->softDeletes();
});
}
@@ -30,6 +32,6 @@ class CreateTableCyclePack extends Migration
*/
public function down()
{
Schema::dropIfExists('cycle_pack');
Schema::dropIfExists('messages');
}
}
@@ -0,0 +1,38 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMediasTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('medias', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('model_id')->nullable();
$table->string('model_type')->nullable();
$table->string('file_name')->nullable();
$table->string('batch_id')->nullable();
$table->string('path');
$table->integer('user_id');
$table->string('file_type')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('medias');
}
}
File diff suppressed because it is too large Load Diff
@@ -1,35 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateItemPackageTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('item_package', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('item_id');
$table->foreign('item_id')->references('id')->on('items');
$table->unsignedBigInteger('package_id');
$table->foreign('package_id')->references('id')->on('packages');
// $table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('item_package');
}
}
@@ -1,38 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCyclesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cycles', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->date('date');
$table->string('sterilizer_id');
$table->text('note')->nullable();
$table->enum('verified',['Verified', 'NotVerified']);
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cycles');
}
}
@@ -1,42 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTablePackes extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('packes', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('unique_id');
$table->date('sterile_date')->nullable();
$table->date('expire_date')->nullable();
$table->string('sterilizer_id');
$table->string('cycle_number');
$table->string('lot_number');
$table->string('department');
$table->text('note')->nullable();
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('packes');
}
}
@@ -1,35 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTablePackPackage extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pack_package', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('pack_id');
$table->foreign('pack_id')->references('id')->on('packes');
$table->unsignedBigInteger('package_id');
$table->foreign('package_id')->references('id')->on('packages');
// $table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pack_package');
}
}