Initial commit for new repo
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m4s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m4s
This commit is contained in:
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
44
database/factories/UserFactory.php
Normal file
44
database/factories/UserFactory.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
50
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
50
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
||||
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal file
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
||||
57
database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file
57
database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE companies (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('companies');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE plants (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
company_id BIGINT NOT NULL,
|
||||
|
||||
code INT NOT NULL CHECK (code >= 1000) UNIQUE,
|
||||
name TEXT NOT NULL UNIQUE, -- CITEXT use extension
|
||||
address TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (company_id) REFERENCES companies (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('plants');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE blocks (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (name, plant_id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('blocks');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE shifts (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
block_id BIGINT NOT NULL,
|
||||
plant_id BIGINT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
|
||||
start_time TIME NOT NULL,
|
||||
duration NUMERIC(4, 2) NOT NULL,
|
||||
end_time TIME NOT NULL, --GENERATED ALWAYS AS (start_time + (duration * INTERVAL '1 hour')) STORED,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (name, block_id, plant_id),
|
||||
FOREIGN KEY (block_id) REFERENCES blocks (id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('shifts');
|
||||
}
|
||||
};
|
||||
41
database/migrations/2025_03_21_090347_create_lines_table.php
Normal file
41
database/migrations/2025_03_21_090347_create_lines_table.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE lines (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
name TEXT NOT NULL,
|
||||
type TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (name, plant_id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('lines');
|
||||
}
|
||||
};
|
||||
43
database/migrations/2025_03_21_090348_create_items_table.php
Normal file
43
database/migrations/2025_03_21_090348_create_items_table.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE items (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
code TEXT NOT NULL CHECK (LENGTH(code) >= 6),
|
||||
description TEXT NOT NULL,
|
||||
|
||||
hourly_quantity INT NOT NULL CHECK (hourly_quantity > 0),
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (code, plant_id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('items');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
|
||||
ALTER TABLE shifts
|
||||
ADD status TEXT NOT NULL DEFAULT 'Active';
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('type');
|
||||
$table->morphs('notifiable');
|
||||
$table->json('data');
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('imports', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamp('completed_at')->nullable();
|
||||
$table->string('file_name');
|
||||
$table->string('file_path');
|
||||
$table->string('importer');
|
||||
$table->unsignedInteger('processed_rows')->default(0);
|
||||
$table->unsignedInteger('total_rows');
|
||||
$table->unsignedInteger('successful_rows')->default(0);
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('imports');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('exports', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamp('completed_at')->nullable();
|
||||
$table->string('file_disk');
|
||||
$table->string('file_name')->nullable();
|
||||
$table->string('exporter');
|
||||
$table->unsignedInteger('processed_rows')->default(0);
|
||||
$table->unsignedInteger('total_rows');
|
||||
$table->unsignedInteger('successful_rows')->default(0);
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('exports');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('failed_import_rows', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->json('data');
|
||||
$table->foreignId('import_id')->constrained()->cascadeOnDelete();
|
||||
$table->text('validation_error')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('failed_import_rows');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$teams = config('permission.teams');
|
||||
$tableNames = config('permission.table_names');
|
||||
$columnNames = config('permission.column_names');
|
||||
$pivotRole = $columnNames['role_pivot_key'] ?? 'role_id';
|
||||
$pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id';
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
|
||||
throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
|
||||
Schema::create($tableNames['permissions'], static function (Blueprint $table) {
|
||||
// $table->engine('InnoDB');
|
||||
$table->bigIncrements('id'); // permission id
|
||||
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['name', 'guard_name']);
|
||||
});
|
||||
|
||||
Schema::create($tableNames['roles'], static function (Blueprint $table) use ($teams, $columnNames) {
|
||||
// $table->engine('InnoDB');
|
||||
$table->bigIncrements('id'); // role id
|
||||
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
|
||||
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
|
||||
}
|
||||
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
|
||||
$table->timestamps();
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
|
||||
} else {
|
||||
$table->unique(['name', 'guard_name']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_permissions'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_roles'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['role_has_permissions'], static function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary');
|
||||
});
|
||||
|
||||
app('cache')
|
||||
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
|
||||
->forget(config('permission.cache.key'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
|
||||
}
|
||||
|
||||
Schema::drop($tableNames['role_has_permissions']);
|
||||
Schema::drop($tableNames['model_has_roles']);
|
||||
Schema::drop($tableNames['model_has_permissions']);
|
||||
Schema::drop($tableNames['roles']);
|
||||
Schema::drop($tableNames['permissions']);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE line_stops (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
code TEXT NOT NULL UNIQUE,
|
||||
reason TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('line_stops');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE production_plans (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
line_id BIGINT NOT NULL,
|
||||
shift_id BIGINT NOT NULL,
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
plan_quantity INT NOT NULL CHECK (plan_quantity > 0),
|
||||
production_quantity INT NOT NULL DEFAULT (0),
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (line_id) REFERENCES lines (id),
|
||||
FOREIGN KEY (shift_id) REFERENCES shifts (id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('production_plans');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE production_line_stops (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
line_id BIGINT NOT NULL,
|
||||
shift_id BIGINT NOT NULL,
|
||||
plant_id BIGINT NOT NULL,
|
||||
linestop_id BIGINT NOT NULL,
|
||||
|
||||
from_datetime TIMESTAMP NOT NULL,
|
||||
to_datetime TIMESTAMP NOT NULL,
|
||||
stop_hour INT NOT NULL,
|
||||
stop_min INT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (line_id) REFERENCES lines (id),
|
||||
FOREIGN KEY (shift_id) REFERENCES shifts (id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (linestop_id) REFERENCES line_stops (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('production_line_stops');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE production_quantities (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
line_id BIGINT NOT NULL,
|
||||
shift_id BIGINT NOT NULL,
|
||||
plant_id BIGINT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
|
||||
serial_number TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, serial_number),
|
||||
FOREIGN KEY (item_id) REFERENCES items (id),
|
||||
FOREIGN KEY (line_id) REFERENCES lines (id),
|
||||
FOREIGN KEY (shift_id) REFERENCES shifts (id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('production_quantities');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE sticker_masters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
item_id BIGINT NOT NULL,
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
serial_number_motor TEXT DEFAULT NULL,
|
||||
serial_number_pump TEXT DEFAULT NULL,
|
||||
serial_number_pumpset TEXT DEFAULT NULL,
|
||||
|
||||
pack_slip_motor TEXT DEFAULT NULL,
|
||||
pack_slip_pump TEXT DEFAULT NULL,
|
||||
pack_slip_pumpset TEXT DEFAULT NULL,
|
||||
|
||||
name_plate_motor TEXT DEFAULT NULL,
|
||||
name_plate_pump TEXT DEFAULT NULL,
|
||||
name_plate_pumpset TEXT DEFAULT NULL,
|
||||
|
||||
tube_sticker_motor TEXT DEFAULT NULL,
|
||||
tube_sticker_pump TEXT DEFAULT NULL,
|
||||
tube_sticker_pumpset TEXT DEFAULT NULL,
|
||||
|
||||
warranty_card TEXT DEFAULT NULL,
|
||||
part_validation1 TEXT DEFAULT NULL,
|
||||
part_validation2 TEXT DEFAULT NULL,
|
||||
part_validation3 TEXT DEFAULT NULL,
|
||||
part_validation4 TEXT DEFAULT NULL,
|
||||
part_validation5 TEXT DEFAULT NULL,
|
||||
|
||||
panel_box_code TEXT DEFAULT NULL,
|
||||
load_rate INT NOT NULL DEFAULT (0),
|
||||
|
||||
bundle_quantity INT DEFAULT NULL,
|
||||
material_type INT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, item_id),
|
||||
FOREIGN KEY (item_id) REFERENCES items (id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sticker_masters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE quality_validations (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
sticker_master_id BIGINT NOT NULL,
|
||||
|
||||
production_order TEXT NOT NULL,
|
||||
|
||||
serial_number_motor TEXT DEFAULT NULL,
|
||||
serial_number_pump TEXT DEFAULT NULL,
|
||||
serial_number_pumpset TEXT DEFAULT NULL,
|
||||
|
||||
pack_slip_motor TEXT DEFAULT NULL,
|
||||
pack_slip_pump TEXT DEFAULT NULL,
|
||||
pack_slip_pumpset TEXT DEFAULT NULL,
|
||||
|
||||
name_plate_motor TEXT DEFAULT NULL,
|
||||
name_plate_pump TEXT DEFAULT NULL,
|
||||
name_plate_pumpset TEXT DEFAULT NULL,
|
||||
|
||||
tube_sticker_motor TEXT DEFAULT NULL,
|
||||
tube_sticker_pump TEXT DEFAULT NULL,
|
||||
tube_sticker_pumpset TEXT DEFAULT NULL,
|
||||
|
||||
warranty_card TEXT DEFAULT NULL,
|
||||
part_validation1 TEXT DEFAULT NULL,
|
||||
part_validation2 TEXT DEFAULT NULL,
|
||||
part_validation3 TEXT DEFAULT NULL,
|
||||
part_validation4 TEXT DEFAULT NULL,
|
||||
part_validation5 TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (sticker_master_id) REFERENCES sticker_masters (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('quality_validations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE invoice_validations (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
sticker_master_id BIGINT NOT NULL,
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
invoice_number TEXT NOT NULL,
|
||||
serial_number TEXT DEFAULT NULL,
|
||||
|
||||
motor_scanned_status TEXT DEFAULT NULL,
|
||||
pump_scanned_status TEXT DEFAULT NULL,
|
||||
capacitor_scanned_status TEXT DEFAULT NULL,
|
||||
scanned_status_set TEXT DEFAULT NULL,
|
||||
scanned_status TEXT DEFAULT NULL,
|
||||
|
||||
panel_box_supplier TEXT DEFAULT NULL,
|
||||
panel_box_serial_number TEXT DEFAULT NULL,
|
||||
|
||||
load_rate INT NOT NULL DEFAULT (0),
|
||||
upload_status TEXT NOT NULL DEFAULT 'N',
|
||||
|
||||
|
||||
batch_number TEXT DEFAULT NULL,
|
||||
quantity INT DEFAULT NULL,
|
||||
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, serial_number),
|
||||
FOREIGN KEY (sticker_master_id) REFERENCES sticker_masters (id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('invoice_validations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
|
||||
ALTER TABLE invoice_validations
|
||||
ADD operator_id TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
|
||||
ALTER TABLE production_line_stops
|
||||
ADD operator_id TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
|
||||
ALTER TABLE production_plans
|
||||
ADD operator_id TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
|
||||
$sql3 = <<<'SQL'
|
||||
|
||||
ALTER TABLE production_quantities
|
||||
ADD operator_id TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
|
||||
ALTER TABLE quality_validations
|
||||
ADD operator_id TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
|
||||
ALTER TABLE production_quantities
|
||||
ADD production_order TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
|
||||
ALTER TABLE quality_validations
|
||||
ADD uom TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
|
||||
ALTER TABLE quality_validations
|
||||
ADD sap_msg_status TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
|
||||
$sql3 = <<<'SQL'
|
||||
|
||||
ALTER TABLE quality_validations
|
||||
ADD sap_msg_description TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql3);
|
||||
|
||||
|
||||
$sql4 = <<<'SQL'
|
||||
|
||||
ALTER TABLE quality_validations
|
||||
ADD serial_number TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
// use Illuminate\Database\Schema\Blueprint;
|
||||
// use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
|
||||
ALTER TABLE items
|
||||
ADD uom TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('items', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
|
||||
ALTER TABLE production_quantities
|
||||
ADD sap_msg_status TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
|
||||
ALTER TABLE production_quantities
|
||||
ADD sap_msg_description TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE weight_validations (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
item_id BIGINT NOT NULL,
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
obd_number TEXT NOT NULL,
|
||||
line_number TEXT DEFAULT NULL,
|
||||
batch_number TEXT DEFAULT NULL,
|
||||
heat_number TEXT DEFAULT NULL,
|
||||
obd_weight TEXT DEFAULT NULL,
|
||||
|
||||
vehicle_number TEXT DEFAULT NULL,
|
||||
bundle_number TEXT DEFAULT NULL,
|
||||
picked_weight TEXT DEFAULT NULL,
|
||||
scanned_by TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (item_id) REFERENCES items (id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('weight_validations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE locators (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
locator_number TEXT NOT NULL,
|
||||
locator_quantity INT NOT NULL DEFAULT (0),
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
operator_id TEXT NOT NULL,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('locators');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE pallet_validations (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
pallet_number TEXT NULL,
|
||||
serial_number TEXT NOT NULL,
|
||||
pallet_status TEXT NULL,
|
||||
locator_number TEXT NULL,
|
||||
locator_quantity INT NOT NULL DEFAULT (0),
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
scanned_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NOT NULL,
|
||||
scanned_by TEXT NOT NULL,
|
||||
updated_by TEXT NULL,
|
||||
|
||||
UNIQUE (plant_id, serial_number),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('pallet_validations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
ALTER TABLE quality_validations
|
||||
ADD COLUMN line_id BIGINT NOT NULL,
|
||||
ADD CONSTRAINT quality_validations_line_id_fkey
|
||||
FOREIGN KEY (line_id) REFERENCES lines(id);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('quality_validations', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE locator_invoice_validations (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
invoice_number TEXT NOT NULL,
|
||||
serial_number TEXT NOT NULL,
|
||||
pallet_number TEXT NULL,
|
||||
locator_number TEXT NULL,
|
||||
scanned_status TEXT NULL,
|
||||
upload_status TEXT NOT NULL DEFAULT 'N',
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP,
|
||||
scanned_at TIMESTAMP,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NOT NULL,
|
||||
scanned_by TEXT NULL,
|
||||
updated_by TEXT NULL,
|
||||
|
||||
UNIQUE (plant_id, serial_number),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('locator_invoice_validations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE configurations (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
line_id BIGINT NOT NULL,
|
||||
|
||||
c_type TEXT NOT NULL,
|
||||
c_group TEXT NOT NULL,
|
||||
c_name TEXT NOT NULL,
|
||||
c_value TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, line_id, c_type, c_group, c_name, c_value),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (line_id) REFERENCES lines (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('configurations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE machines (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
line_id BIGINT NOT NULL,
|
||||
|
||||
name TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, line_id, name),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (line_id) REFERENCES lines (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('machines');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE motor_testing_masters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
|
||||
isi_model BOOLEAN DEFAULT FALSE,
|
||||
phase TEXT NOT NULL,
|
||||
hp TEXT NOT NULL,
|
||||
kw TEXT NOT NULL,
|
||||
|
||||
volt TEXT NOT NULL,
|
||||
current TEXT NOT NULL,
|
||||
rpm TEXT NOT NULL,
|
||||
torque TEXT NOT NULL,
|
||||
frequency TEXT NOT NULL,
|
||||
connection TEXT NOT NULL,
|
||||
ins_res_limit TEXT NOT NULL,
|
||||
ins_res_type TEXT NOT NULL DEFAULT 'O',
|
||||
|
||||
res_ry_ll TEXT NOT NULL DEFAULT '0.05',
|
||||
res_ry_ul TEXT NOT NULL DEFAULT '99',
|
||||
res_yb_ll TEXT NOT NULL DEFAULT '0.05',
|
||||
res_yb_ul TEXT NOT NULL DEFAULT '99',
|
||||
res_br_ll TEXT NOT NULL DEFAULT '0.05',
|
||||
res_br_ul TEXT NOT NULL DEFAULT '99',
|
||||
|
||||
lock_volt_limit TEXT NOT NULL,
|
||||
leak_cur_limit TEXT NOT NULL,
|
||||
lock_cur_ll TEXT NOT NULL,
|
||||
lock_cur_ul TEXT NOT NULL,
|
||||
|
||||
noload_cur_ll TEXT NOT NULL,
|
||||
noload_cur_ul TEXT NOT NULL,
|
||||
|
||||
noload_pow_ll TEXT NOT NULL,
|
||||
noload_pow_ul TEXT NOT NULL,
|
||||
|
||||
noload_spd_ll TEXT NOT NULL,
|
||||
noload_spd_ul TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NOT NULL,
|
||||
updated_by TEXT NOT NULL,
|
||||
|
||||
UNIQUE (plant_id, item_id),
|
||||
|
||||
FOREIGN KEY (item_id) REFERENCES items (id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('motor_testing_masters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE testing_panel_readings (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
line_id BIGINT NOT NULL,
|
||||
motor_testing_master_id BIGINT NOT NULL,
|
||||
machine_id BIGINT NOT NULL,
|
||||
|
||||
output TEXT NOT NULL,
|
||||
serial_number TEXT NOT NULL,
|
||||
before_fr_volt TEXT DEFAULT '0',
|
||||
before_fr_cur TEXT DEFAULT '0',
|
||||
before_fr_pow TEXT DEFAULT '0',
|
||||
before_fr_res_ry TEXT DEFAULT '0',
|
||||
before_fr_res_yb TEXT DEFAULT '0',
|
||||
before_fr_res_br TEXT DEFAULT '0',
|
||||
before_fr_ir TEXT DEFAULT '0',
|
||||
before_fr_ir_r TEXT DEFAULT '0',
|
||||
before_fr_ir_y TEXT DEFAULT '0',
|
||||
before_fr_ir_b TEXT DEFAULT '0',
|
||||
before_fr_freq TEXT DEFAULT '0',
|
||||
before_fr_speed TEXT DEFAULT '0',
|
||||
after_fr_vol TEXT DEFAULT '0',
|
||||
after_fr_cur TEXT DEFAULT '0',
|
||||
after_fr_pow TEXT DEFAULT '0',
|
||||
after_fr_ir_hot TEXT DEFAULT '0',
|
||||
after_fr_ir_hot_r TEXT DEFAULT '0',
|
||||
after_fr_ir_hot_y TEXT DEFAULT '0',
|
||||
after_fr_ir_hot_b TEXT DEFAULT '0',
|
||||
after_fr_ir_cool TEXT DEFAULT '0',
|
||||
after_fr_ir_cool_r TEXT DEFAULT '0',
|
||||
after_fr_ir_cool_y TEXT DEFAULT '0',
|
||||
after_fr_ir_cool_b TEXT DEFAULT '0',
|
||||
after_fr_freq TEXT DEFAULT '0',
|
||||
after_fr_speed TEXT DEFAULT '0',
|
||||
after_fr_leak_cur TEXT DEFAULT '0',
|
||||
locked_rt_volt TEXT DEFAULT '0',
|
||||
locked_rt_cur TEXT DEFAULT '0',
|
||||
locked_rt_pow TEXT DEFAULT '0',
|
||||
no_load_pickup_volt TEXT DEFAULT '0',
|
||||
room_temperature TEXT NULL,
|
||||
hv_test TEXT NULL,
|
||||
batch_number TEXT NULL,
|
||||
batch_count TEXT NOT NULL DEFAULT '0',
|
||||
result TEXT NULL,
|
||||
remark TEXT NULL,
|
||||
|
||||
rework_count TEXT NOT NULL DEFAULT '0',
|
||||
update_count TEXT NOT NULL DEFAULT '0',
|
||||
output_flag TEXT NOT NULL DEFAULT '0',
|
||||
|
||||
tested_by TEXT NULL,
|
||||
updated_by TEXT NULL,
|
||||
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
scanned_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, motor_testing_master_id, serial_number, machine_id, line_id, rework_count, update_count),
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (motor_testing_master_id) REFERENCES motor_testing_masters (id),
|
||||
FOREIGN KEY (machine_id) REFERENCES machines (id),
|
||||
FOREIGN KEY (line_id) REFERENCES lines (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('testing_panel_readings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql2 = <<<'SQL'
|
||||
|
||||
ALTER TABLE motor_testing_masters
|
||||
ADD routine_test_time TIME NOT NULL DEFAULT '00:40:00';
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('motor_testing_masters', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
|
||||
ALTER TABLE items
|
||||
ADD category TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('item_masters', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
|
||||
ALTER TABLE lines
|
||||
ADD group_work_center TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('line_masters', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
|
||||
ALTER TABLE machines
|
||||
ADD work_center TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('machines', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
|
||||
ALTER TABLE sticker_masters
|
||||
ADD laser_part_validation1 TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
|
||||
ALTER TABLE sticker_masters
|
||||
ADD laser_part_validation2 TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('sticker_masters', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE rework_locator_invoice_validations (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
invoice_number TEXT NOT NULL,
|
||||
serial_number TEXT NOT NULL,
|
||||
pallet_number TEXT NULL,
|
||||
locator_number TEXT NULL,
|
||||
scanned_status TEXT NULL,
|
||||
upload_status TEXT NOT NULL DEFAULT 'N',
|
||||
|
||||
created_by TEXT NOT NULL,
|
||||
scanned_by TEXT NULL,
|
||||
updated_by TEXT NULL,
|
||||
reworked_by TEXT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP,
|
||||
scanned_at TIMESTAMP,
|
||||
reworked_at TIMESTAMP,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('rework_locator_invoice_validations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// Schema::create('guard_names', function (Blueprint $table) {
|
||||
// $table->id();
|
||||
// $table->timestamps();
|
||||
// });
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE guard_names (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
name TEXT NOT NULL,
|
||||
identification1 TEXT NOT NULL,
|
||||
identification2 TEXT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NOT NULL,
|
||||
|
||||
UNIQUE (plant_id, name),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('guard_names');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// Schema::create('check_point_names', function (Blueprint $table) {
|
||||
// $table->id();
|
||||
// $table->timestamps();
|
||||
// });
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE check_point_names (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
name TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NOT NULL,
|
||||
|
||||
UNIQUE (plant_id, name),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('check_point_names');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// Schema::create('check_point_times', function (Blueprint $table) {
|
||||
// $table->id();
|
||||
// $table->timestamps();
|
||||
// });
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE check_point_times (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
check_point1_id BIGINT NOT NULL,
|
||||
check_point2_id BIGINT NOT NULL,
|
||||
|
||||
sequence_number INT NOT NULL DEFAULT (1),
|
||||
time_lapse INT NOT NULL DEFAULT (1),
|
||||
time_lapse_cushioning INT NOT NULL DEFAULT (1),
|
||||
min_cushioning INT NOT NULL DEFAULT (0),
|
||||
max_cushioning INT NOT NULL DEFAULT (2),
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NOT NULL,
|
||||
|
||||
UNIQUE (plant_id, check_point1_id, check_point2_id, sequence_number),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (check_point1_id) REFERENCES check_point_names (id),
|
||||
FOREIGN KEY (check_point2_id) REFERENCES check_point_names (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('check_point_times');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// Schema::create('guard_patrol_entries', function (Blueprint $table) {
|
||||
// $table->id();
|
||||
// $table->timestamps();
|
||||
// });
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE guard_patrol_entries (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
guard_name_id BIGINT NOT NULL,
|
||||
check_point_name_id BIGINT NOT NULL,
|
||||
|
||||
reader_code TEXT NULL,
|
||||
patrol_time TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NOT NULL,
|
||||
updated_by TEXT NOT NULL,
|
||||
|
||||
UNIQUE (plant_id, guard_name_id, check_point_name_id, patrol_time),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (guard_name_id) REFERENCES guard_names (id),
|
||||
FOREIGN KEY (check_point_name_id) REFERENCES check_point_names (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('guard_patrol_entries');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE alert_mail_rules (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant BIGINT NOT NULL DEFAULT(0),
|
||||
|
||||
module TEXT NOT NULL,
|
||||
rule_name TEXT NOT NULL,
|
||||
|
||||
email TEXT NOT NULL,
|
||||
schedule_type TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NOT NULL,
|
||||
updated_by TEXT NOT NULL
|
||||
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('alert_mail_rules');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE module_lists (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
module_name TEXT NOT NULL,
|
||||
dashboard_name TEXT NOT NULL,
|
||||
filter_name TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NULL,
|
||||
updated_by TEXT NULL,
|
||||
|
||||
UNIQUE (module_name, dashboard_name, filter_name)
|
||||
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('module_lists');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE mfm_meters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
sequence TEXT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NULL,
|
||||
|
||||
UNIQUE (plant_id, sequence),
|
||||
UNIQUE (plant_id, name),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('mfm_meters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE temp_live_readings (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
mfm_meter_id BIGINT NOT NULL,
|
||||
|
||||
register_data TEXT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NULL,
|
||||
|
||||
UNIQUE (created_at, mfm_meter_id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (mfm_meter_id) REFERENCES mfm_meters (id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('temp_live_readings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE mfm_parameters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
mfm_meter_id BIGINT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
|
||||
register_id TEXT NOT NULL,
|
||||
identifier TEXT NOT NULL,
|
||||
|
||||
byte_to_convert INT NOT NULL,
|
||||
type_to_convert TEXT NOT NULL,
|
||||
decimal_to_display INT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, mfm_meter_id, name),
|
||||
UNIQUE (plant_id, mfm_meter_id, register_id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (mfm_meter_id) REFERENCES mfm_meters (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('mfm_parameters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE mfm_readings (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
mfm_meter_id BIGINT NOT NULL,
|
||||
|
||||
apparent_energy_received TEXT DEFAULT NULL,
|
||||
reactive_energy_received TEXT DEFAULT NULL,
|
||||
active_energy_received TEXT DEFAULT NULL,
|
||||
active_power_r TEXT DEFAULT NULL,
|
||||
active_power_y TEXT DEFAULT NULL,
|
||||
active_power_b TEXT DEFAULT NULL,
|
||||
active_power_total TEXT DEFAULT NULL,
|
||||
voltage_ry TEXT DEFAULT NULL,
|
||||
voltage_yb TEXT DEFAULT NULL,
|
||||
voltage_br TEXT DEFAULT NULL,
|
||||
current_r TEXT DEFAULT NULL,
|
||||
current_y TEXT DEFAULT NULL,
|
||||
current_b TEXT DEFAULT NULL,
|
||||
current_n TEXT DEFAULT NULL,
|
||||
voltage_r_n TEXT DEFAULT NULL,
|
||||
voltage_y_n TEXT DEFAULT NULL,
|
||||
voltage_b_n TEXT DEFAULT NULL,
|
||||
frequency TEXT DEFAULT NULL,
|
||||
power_factor_r TEXT DEFAULT NULL,
|
||||
power_factor_y TEXT DEFAULT NULL,
|
||||
power_factor_b TEXT DEFAULT NULL,
|
||||
power_factor_total TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, created_at, mfm_meter_id),
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (mfm_meter_id) REFERENCES mfm_meters (id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('mfm_readings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE device_masters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
name TEXT NOT NULL,
|
||||
mac_address TEXT DEFAULT NULL,
|
||||
ip_address TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NULL,
|
||||
|
||||
UNIQUE (name, plant_id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('device_masters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
ALTER TABLE mfm_meters
|
||||
ADD COLUMN device_master_id BIGINT NOT NULL,
|
||||
ADD CONSTRAINT mfm_meters_device_master_id_fkey
|
||||
FOREIGN KEY (device_master_id) REFERENCES device_masters(id);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE mfm_meters
|
||||
ADD UNIQUE (plant_id, device_master_id, name);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('mfm_meters', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
ALTER TABLE mfm_parameters
|
||||
ADD COLUMN device_master_id BIGINT NOT NULL,
|
||||
ADD CONSTRAINT mfm_parameters_device_master_id_fkey
|
||||
FOREIGN KEY (device_master_id) REFERENCES device_masters(id);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('mfm_parameters', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE eb_readings (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
lcd_segment_check TEXT DEFAULT NULL,
|
||||
meter_serial_no TEXT DEFAULT NULL,
|
||||
eb_date_time TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
ph_seq_of_volt TEXT DEFAULT NULL,
|
||||
ph_assoc_conn_check TEXT DEFAULT NULL,
|
||||
instantaneous_ph_volt TEXT DEFAULT NULL,
|
||||
instantaneous_curr TEXT DEFAULT NULL,
|
||||
instantaneous_freq TEXT DEFAULT NULL,
|
||||
instantaneous_kw_with_sign TEXT DEFAULT NULL,
|
||||
instantaneous_kva TEXT DEFAULT NULL,
|
||||
instantaneous_kv_ar TEXT DEFAULT NULL,
|
||||
instantaneous_pf_with_sign TEXT DEFAULT NULL,
|
||||
rd_with_elapsed_time_kva TEXT DEFAULT NULL,
|
||||
cum_active_import_energy TEXT DEFAULT NULL,
|
||||
tod1_active_energy_6_9 TEXT DEFAULT NULL,
|
||||
tod2_active_energy_18_21 TEXT DEFAULT NULL,
|
||||
tod3_active_energy_21_22 TEXT DEFAULT NULL,
|
||||
tod4_active_energy_5_6_9_18 TEXT DEFAULT NULL,
|
||||
tod5_active_energy_22_5 TEXT DEFAULT NULL,
|
||||
cum_reac_lag_energy TEXT DEFAULT NULL,
|
||||
cum_reac_lead_energy TEXT DEFAULT NULL,
|
||||
cum_appar_energy TEXT DEFAULT NULL,
|
||||
tod1_appar_energy_6_9 TEXT DEFAULT NULL,
|
||||
tod2_appar_energy_18_21 TEXT DEFAULT NULL,
|
||||
tod3_appar_energy_21_22 TEXT DEFAULT NULL,
|
||||
tod4_appar_energy_5_6_9_18 TEXT DEFAULT NULL,
|
||||
tod5_appar_energy_22_5 TEXT DEFAULT NULL,
|
||||
avg_pow_factor TEXT DEFAULT NULL,
|
||||
avg_freq_15min_last_ip TEXT DEFAULT NULL,
|
||||
net_kv_arh_high TEXT DEFAULT NULL,
|
||||
net_kv_arh_low TEXT DEFAULT NULL,
|
||||
cum_md_kva TEXT DEFAULT NULL,
|
||||
present_md_kva TEXT DEFAULT NULL,
|
||||
present_md_kva_date_time TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
tod1_md_kva_6_9 TEXT DEFAULT NULL,
|
||||
tod2_md_kva_18_21 TEXT DEFAULT NULL,
|
||||
tod3_md_kva_21_22 TEXT DEFAULT NULL,
|
||||
tod4_md_kva_5_6_9_18 TEXT DEFAULT NULL,
|
||||
tod5_md_kva_22_5 TEXT DEFAULT NULL,
|
||||
total_pow_off_hours TEXT DEFAULT NULL,
|
||||
programming_count TEXT DEFAULT NULL,
|
||||
last_occ_res_event_type TEXT DEFAULT NULL,
|
||||
last_occ_res_event_date_time TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
tamper_count TEXT DEFAULT NULL,
|
||||
reset_count TEXT DEFAULT NULL,
|
||||
last_md_reset_date_time TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
electrician_sign TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
updated_by TEXT NULL,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('eb_readings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE work_group_masters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
name TEXT DEFAULT NULL,
|
||||
description TEXT DEFAULT NULL,
|
||||
operation_number TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT DEFAULT NULL,
|
||||
|
||||
unique(plant_id, name),
|
||||
unique(plant_id, operation_number),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('work_group_masters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
ALTER TABLE lines
|
||||
ADD COLUMN no_of_operation INT NOT NULL DEFAULT 0,
|
||||
|
||||
ADD COLUMN work_group1_id BIGINT DEFAULT NULL,
|
||||
ADD COLUMN work_group2_id BIGINT DEFAULT NULL,
|
||||
ADD COLUMN work_group3_id BIGINT DEFAULT NULL,
|
||||
ADD COLUMN work_group4_id BIGINT DEFAULT NULL,
|
||||
ADD COLUMN work_group5_id BIGINT DEFAULT NULL,
|
||||
ADD COLUMN work_group6_id BIGINT DEFAULT NULL,
|
||||
ADD COLUMN work_group7_id BIGINT DEFAULT NULL,
|
||||
ADD COLUMN work_group8_id BIGINT DEFAULT NULL,
|
||||
ADD COLUMN work_group9_id BIGINT DEFAULT NULL,
|
||||
ADD COLUMN work_group10_id BIGINT DEFAULT NULL,
|
||||
ADD CONSTRAINT lines_work_group1_id_fkey
|
||||
FOREIGN KEY (work_group1_id) REFERENCES work_group_masters(id),
|
||||
ADD CONSTRAINT lines_work_group2_id_fkey
|
||||
FOREIGN KEY (work_group2_id) REFERENCES work_group_masters(id),
|
||||
ADD CONSTRAINT lines_work_group3_id_fkey
|
||||
FOREIGN KEY (work_group3_id) REFERENCES work_group_masters(id),
|
||||
ADD CONSTRAINT lines_work_group4_id_fkey
|
||||
FOREIGN KEY (work_group4_id) REFERENCES work_group_masters(id),
|
||||
ADD CONSTRAINT lines_work_group5_id_fkey
|
||||
FOREIGN KEY (work_group5_id) REFERENCES work_group_masters(id),
|
||||
ADD CONSTRAINT lines_work_group6_id_fkey
|
||||
FOREIGN KEY (work_group6_id) REFERENCES work_group_masters(id),
|
||||
ADD CONSTRAINT lines_work_group7_id_fkey
|
||||
FOREIGN KEY (work_group7_id) REFERENCES work_group_masters(id),
|
||||
ADD CONSTRAINT lines_work_group8_id_fkey
|
||||
FOREIGN KEY (work_group8_id) REFERENCES work_group_masters(id),
|
||||
ADD CONSTRAINT lines_work_group9_id_fkey
|
||||
FOREIGN KEY (work_group9_id) REFERENCES work_group_masters(id),
|
||||
ADD CONSTRAINT lines_work_group10_id_fkey
|
||||
FOREIGN KEY (work_group10_id) REFERENCES work_group_masters(id);
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('lines', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE machines
|
||||
ADD COLUMN work_group_master_id BIGINT NOT NULL,
|
||||
ADD CONSTRAINT machines_work_group_master_id_fkey
|
||||
FOREIGN KEY (work_group_master_id) REFERENCES work_group_masters(id);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
ALTER TABLE machines
|
||||
ADD UNIQUE (plant_id, work_center);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('machines', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement('ALTER TABLE lines DROP COLUMN group_work_center');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('lines', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE reject_reasons (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
line_id BIGINT NOT NULL,
|
||||
work_group_master_id BIGINT NOT NULL,
|
||||
|
||||
code TEXT DEFAULT NULL,
|
||||
reason TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT DEFAULT NULL,
|
||||
|
||||
unique(plant_id, line_id, work_group_master_id, code),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (line_id) REFERENCES lines (id),
|
||||
FOREIGN KEY (work_group_master_id) REFERENCES work_group_masters(id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('reject_reasons');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
|
||||
ALTER TABLE production_quantities
|
||||
ADD success_status TEXT DEFAULT 'Ok';
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('production_quantities', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
|
||||
ALTER TABLE production_quantities
|
||||
ADD notok_at TIMESTAMP;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('production_quantities', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
|
||||
ALTER TABLE production_quantities
|
||||
ADD no_of_employee TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
|
||||
ALTER TABLE production_quantities
|
||||
ADD list_of_employee TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('production_quantities', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE equipment_masters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
machine_id BIGINT NOT NULL,
|
||||
name TEXT DEFAULT NULL,
|
||||
description TEXT DEFAULT NULL,
|
||||
make TEXT DEFAULT NULL,
|
||||
model TEXT DEFAULT NULL,
|
||||
equipment_number TEXT DEFAULT NULL,
|
||||
instrument_serial_number TEXT DEFAULT NULL,
|
||||
calibrated_on TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
frequency INT NOT NULL DEFAULT (1),
|
||||
next_calibration_date TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
calibrated_by TEXT DEFAULT NULL,
|
||||
calibration_certificate TEXT DEFAULT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
unique(plant_id, equipment_number),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (machine_id) REFERENCES machines(id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('equipment_masters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
|
||||
ALTER TABLE motor_testing_masters
|
||||
ADD subassembly_code TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('motor_testing_masters', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE sticker_mapping_masters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
sticker1 TEXT DEFAULT NULL,
|
||||
sticker2 TEXT DEFAULT NULL,
|
||||
sticker3 TEXT DEFAULT NULL,
|
||||
sticker4 TEXT DEFAULT NULL,
|
||||
sticker5 TEXT DEFAULT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (item_id) REFERENCES items(id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sticker_mapping_masters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE process_orders (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
process_order TEXT DEFAULT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (item_id) REFERENCES items(id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('process_orders');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE product_characteristics_masters(
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
line_id BIGINT DEFAULT NULL,
|
||||
work_group_master_id BIGINT DEFAULT NULL,
|
||||
machine_id BIGINT DEFAULT NULL,
|
||||
name TEXT DEFAULT NULL,
|
||||
inspection_type TEXT DEFAULT NULL,
|
||||
characteristics_type TEXT DEFAULT NULL
|
||||
upper DOUBLE PRECISION DEFAULT 0.0,
|
||||
lower DOUBLE PRECISION DEFAULT 0.0,
|
||||
middle DOUBLE PRECISION DEFAULT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (line_id) REFERENCES lines (id),
|
||||
FOREIGN KEY (item_id) REFERENCES items(id),
|
||||
FOREIGN KEY (work_group_master_id) REFERENCES work_group_masters(id),
|
||||
FOREIGN KEY (machine_id) REFERENCES machines(id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('product_characteristics_masters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE product_characteristics_masters
|
||||
ADD COLUMN characteristics_type TEXT DEFAULT NULL;
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
ALTER TABLE product_characteristics_masters
|
||||
RENAME COLUMN type TO inspection_type;
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('product_characteristics_masters', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE product_characteristics_masters
|
||||
ADD COLUMN work_group_master_id BIGINT DEFAULT NULL,
|
||||
ADD CONSTRAINT product_characteristics_masters_work_group_master_id_fkey
|
||||
FOREIGN KEY (work_group_master_id) REFERENCES work_group_masters(id);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('product_characteristics_masters', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
|
||||
ALTER TABLE testing_panel_readings
|
||||
ADD winded_serial_number TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('testing_panel_readings', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE driver_masters(
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
name TEXT DEFAULT NULL,
|
||||
identification1 TEXT DEFAULT NULL,
|
||||
identification2 TEXT DEFAULT NULL,
|
||||
identification3 TEXT DEFAULT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP
|
||||
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('driver_masters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
|
||||
ALTER TABLE driver_masters
|
||||
ADD contact_number TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
|
||||
ALTER TABLE driver_masters
|
||||
ADD alternate_number TEXT DEFAULT NULL;
|
||||
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('driver_master', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE tracking_device_masters(
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
name TEXT DEFAULT NULL,
|
||||
status TEXT DEFAULT NULL,
|
||||
serial_number TEXT DEFAULT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tracking_device_masters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE vehicle_masters(
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
driver_master_id BIGINT NOT NULL,
|
||||
tracking_device_master_id BIGINT DEFAULT NULL,
|
||||
registration_number TEXT DEFAULT NULL,
|
||||
model TEXT DEFAULT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (driver_master_id) REFERENCES driver_masters (id),
|
||||
FOREIGN KEY (tracking_device_master_id) REFERENCES tracking_device_masters (id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('vehicle_masters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE vehicle_trackings(
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
vehicle_master_id BIGINT NOT NULL,
|
||||
latitude DOUBLE PRECISION NOT NULL,
|
||||
longitude DOUBLE PRECISION NOT NULL,
|
||||
accuracy REAL,
|
||||
status TEXT DEFAULT NULL,
|
||||
distance_covered_km REAL DEFAULT 0,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (vehicle_master_id) REFERENCES vehicle_masters (id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('vehicle_trackings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE gr_masters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
serial_number TEXT DEFAULT NULL,
|
||||
gr_number TEXT DEFAULT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (item_id) REFERENCES items(id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('gr_masters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE class_characteristics (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
machine_id BIGINT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
aufnr TEXT DEFAULT NULL,
|
||||
class TEXT DEFAULT NULL,
|
||||
arbid TEXT DEFAULT NULL,
|
||||
gamng TEXT DEFAULT NULL,
|
||||
lmnga TEXT DEFAULT NULL,
|
||||
gernr TEXT DEFAULT NULL,
|
||||
zz1_cn_bill_ord TEXT DEFAULT NULL,
|
||||
zmm_amps TEXT DEFAULT NULL,
|
||||
zmm_brand TEXT DEFAULT NULL,
|
||||
zmm_degreeofprotection TEXT DEFAULT NULL,
|
||||
zmm_delivery TEXT DEFAULT NULL,
|
||||
zmm_dir_rot TEXT DEFAULT NULL,
|
||||
zmm_discharge TEXT DEFAULT NULL,
|
||||
zmm_discharge_max TEXT DEFAULT NULL,
|
||||
zmm_discharge_min TEXT DEFAULT NULL,
|
||||
zmm_duty TEXT DEFAULT NULL,
|
||||
zmm_eff_motor TEXT DEFAULT NULL,
|
||||
zmm_eff_pump TEXT DEFAULT NULL,
|
||||
zmm_frequency TEXT DEFAULT NULL,
|
||||
zmm_head TEXT DEFAULT NULL,
|
||||
zmm_heading TEXT DEFAULT NULL,
|
||||
zmm_head_max TEXT DEFAULT NULL,
|
||||
zmm_head_minimum TEXT DEFAULT NULL,
|
||||
zmm_idx_eff_mtr TEXT DEFAULT NULL,
|
||||
zmm_idx_eff_pump TEXT DEFAULT NULL,
|
||||
zmm_kvacode TEXT DEFAULT NULL,
|
||||
zmm_maxambtemp TEXT DEFAULT NULL,
|
||||
zmm_mincoolingflow TEXT DEFAULT NULL,
|
||||
zmm_motorseries TEXT DEFAULT NULL,
|
||||
zmm_motor_model TEXT DEFAULT NULL,
|
||||
zmm_outlet TEXT DEFAULT NULL,
|
||||
zmm_phase TEXT DEFAULT NULL,
|
||||
zmm_pressure TEXT DEFAULT NULL,
|
||||
zmm_pumpflowtype TEXT DEFAULT NULL,
|
||||
zmm_pumpseries TEXT DEFAULT NULL,
|
||||
zmm_pump_model TEXT DEFAULT NULL,
|
||||
zmm_ratedpower TEXT DEFAULT NULL,
|
||||
zmm_region TEXT DEFAULT NULL,
|
||||
zmm_servicefactor TEXT DEFAULT NULL,
|
||||
zmm_servicefactormaximumamps TEXT DEFAULT NULL,
|
||||
zmm_speed TEXT DEFAULT NULL,
|
||||
zmm_suction TEXT DEFAULT NULL,
|
||||
zmm_suctionxdelivery TEXT DEFAULT NULL,
|
||||
zmm_supplysource TEXT DEFAULT NULL,
|
||||
zmm_temperature TEXT DEFAULT NULL,
|
||||
zmm_thrustload TEXT DEFAULT NULL,
|
||||
zmm_volts TEXT DEFAULT NULL,
|
||||
zmm_wire TEXT DEFAULT NULL,
|
||||
zmm_package TEXT DEFAULT NULL,
|
||||
zmm_pvarrayrating TEXT DEFAULT NULL,
|
||||
zmm_isi TEXT DEFAULT NULL,
|
||||
zmm_isimotor TEXT DEFAULT NULL,
|
||||
zmm_isipump TEXT DEFAULT NULL,
|
||||
zmm_isipumpset TEXT DEFAULT NULL,
|
||||
zmm_pumpset_model TEXT DEFAULT NULL,
|
||||
zmm_stages TEXT DEFAULT NULL,
|
||||
zmm_headrange TEXT DEFAULT NULL,
|
||||
zmm_overall_efficiency TEXT DEFAULT NULL,
|
||||
zmm_connection TEXT DEFAULT NULL,
|
||||
zmm_min_bore_size TEXT DEFAULT NULL,
|
||||
zmm_isireference TEXT DEFAULT NULL,
|
||||
zmm_category TEXT DEFAULT NULL,
|
||||
zmm_submergence TEXT DEFAULT NULL,
|
||||
zmm_capacitorstart TEXT DEFAULT NULL,
|
||||
zmm_capacitorrun TEXT DEFAULT NULL,
|
||||
zmm_inch TEXT DEFAULT NULL,
|
||||
zmm_motor_type TEXT DEFAULT NULL,
|
||||
zmm_dismantle_direction TEXT DEFAULT NULL,
|
||||
zmm_eff_ovrall TEXT DEFAULT NULL,
|
||||
zmm_bodymoc TEXT DEFAULT NULL,
|
||||
zmm_rotormoc TEXT DEFAULT NULL,
|
||||
zmm_dlwl TEXT DEFAULT NULL,
|
||||
zmm_inputpower TEXT DEFAULT NULL,
|
||||
zmm_imp_od TEXT DEFAULT NULL,
|
||||
zmm_ambtemp TEXT DEFAULT NULL,
|
||||
zmm_de TEXT DEFAULT NULL,
|
||||
zmm_dischargerange TEXT DEFAULT NULL,
|
||||
zmm_efficiency_class TEXT DEFAULT NULL,
|
||||
zmm_framesize TEXT DEFAULT NULL,
|
||||
zmm_impellerdiameter TEXT DEFAULT NULL,
|
||||
zmm_insulationclass TEXT DEFAULT NULL,
|
||||
zmm_maxflow TEXT DEFAULT NULL,
|
||||
zmm_minhead TEXT DEFAULT NULL,
|
||||
zmm_mtrlofconst TEXT DEFAULT NULL,
|
||||
zmm_nde TEXT DEFAULT NULL,
|
||||
zmm_powerfactor TEXT DEFAULT NULL,
|
||||
zmm_tagno TEXT DEFAULT NULL,
|
||||
zmm_year TEXT DEFAULT NULL,
|
||||
zmm_laser_name TEXT DEFAULT NULL,
|
||||
zmm_beenote TEXT DEFAULT NULL,
|
||||
zmm_beenumber TEXT DEFAULT NULL,
|
||||
zmm_beestar TEXT DEFAULT NULL,
|
||||
zmm_logo_ce TEXT DEFAULT NULL,
|
||||
zmm_codeclass TEXT DEFAULT NULL,
|
||||
zmm_colour TEXT DEFAULT NULL,
|
||||
zmm_logo_cp TEXT DEFAULT NULL,
|
||||
zmm_grade TEXT DEFAULT NULL,
|
||||
zmm_grwt_pset TEXT DEFAULT NULL,
|
||||
zmm_grwt_cable TEXT DEFAULT NULL,
|
||||
zmm_grwt_motor TEXT DEFAULT NULL,
|
||||
zmm_grwt_pf TEXT DEFAULT NULL,
|
||||
zmm_grwt_pump TEXT DEFAULT NULL,
|
||||
zmm_isivalve TEXT DEFAULT NULL,
|
||||
zmm_isi_wc TEXT DEFAULT NULL,
|
||||
zmm_labelperiod TEXT DEFAULT NULL,
|
||||
zmm_length TEXT DEFAULT NULL,
|
||||
zmm_license_cml_no TEXT DEFAULT NULL,
|
||||
zmm_mfgmonyr TEXT DEFAULT NULL,
|
||||
zmm_modelyear TEXT DEFAULT NULL,
|
||||
zmm_motoridentification TEXT DEFAULT NULL,
|
||||
zmm_newt_pset TEXT DEFAULT NULL,
|
||||
zmm_newt_cable TEXT DEFAULT NULL,
|
||||
zmm_newt_motor TEXT DEFAULT NULL,
|
||||
zmm_newt_pf TEXT DEFAULT NULL,
|
||||
zmm_newt_pump TEXT DEFAULT NULL,
|
||||
zmm_logo_nsf TEXT DEFAULT NULL,
|
||||
zmm_packtype TEXT DEFAULT NULL,
|
||||
zmm_panel TEXT DEFAULT NULL,
|
||||
zmm_performance_factor TEXT DEFAULT NULL,
|
||||
zmm_pumpidentification TEXT DEFAULT NULL,
|
||||
zmm_psettype TEXT DEFAULT NULL,
|
||||
zmm_size TEXT DEFAULT NULL,
|
||||
zmm_eff_ttl TEXT DEFAULT NULL,
|
||||
zmm_type TEXT DEFAULT NULL,
|
||||
zmm_usp TEXT DEFAULT NULL,
|
||||
mark_status TEXT DEFAULT NULL,
|
||||
marked_datetime TIMESTAMP DEFAULT NULL,
|
||||
marked_by TEXT DEFAULT NULL,
|
||||
man_marked_status TEXT DEFAULT NULL,
|
||||
man_marked_datetime TIMESTAMP DEFAULT NULL,
|
||||
man_marked_by TEXT DEFAULT NULL,
|
||||
motor_marked_status TEXT DEFAULT NULL,
|
||||
pump_marked_status TEXT DEFAULT NULL,
|
||||
motor_pump_pumpset_status TEXT DEFAULT NULL,
|
||||
part_validation_1 TEXT DEFAULT NULL,
|
||||
part_validation_2 TEXT DEFAULT NULL,
|
||||
samlight_logged_name TEXT DEFAULT NULL,
|
||||
pending_released_status INTEGER DEFAULT 0,
|
||||
expected_time TEXT DEFAULT '0',
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (machine_id) REFERENCES machines (id),
|
||||
FOREIGN KEY (item_id) REFERENCES items(id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('class_characteristics');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE quality_validations
|
||||
ADD UNIQUE (plant_id, serial_number);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('quality_validations', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
ALTER TABLE users
|
||||
ADD COLUMN plant_id BIGINT DEFAULT NULL,
|
||||
ADD CONSTRAINT users_plant_id_fkey
|
||||
FOREIGN KEY (plant_id) REFERENCES plants(id);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('users', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE serial_validations (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
sticker_master_id BIGINT NOT NULL,
|
||||
|
||||
invoice_number TEXT NOT NULL,
|
||||
serial_number TEXT DEFAULT NULL,
|
||||
|
||||
motor_scanned_status TEXT DEFAULT NULL,
|
||||
pump_scanned_status TEXT DEFAULT NULL,
|
||||
capacitor_scanned_status TEXT DEFAULT NULL,
|
||||
scanned_status_set TEXT DEFAULT NULL,
|
||||
scanned_status TEXT DEFAULT NULL,
|
||||
|
||||
panel_box_supplier TEXT DEFAULT NULL,
|
||||
panel_box_serial_number TEXT DEFAULT NULL,
|
||||
|
||||
load_rate INT NOT NULL DEFAULT (0),
|
||||
upload_status TEXT NOT NULL DEFAULT 'N',
|
||||
|
||||
|
||||
batch_number TEXT DEFAULT NULL,
|
||||
quantity INT DEFAULT NULL,
|
||||
operator_id TEXT DEFAULT NULL,
|
||||
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, serial_number),
|
||||
FOREIGN KEY (sticker_master_id) REFERENCES sticker_masters (id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('serial_validations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE gr_masters
|
||||
ADD COLUMN status TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('gr_masters', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ADD COLUMN mark_status TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ADD COLUMN marked_datetime TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
|
||||
$sql3 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ADD COLUMN marked_by TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql3);
|
||||
|
||||
$sql4 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ADD COLUMN man_marked_status TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql4);
|
||||
|
||||
$sql5 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ADD COLUMN man_marked_datetime TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql5);
|
||||
|
||||
$sql6 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ADD COLUMN man_marked_by TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql6);
|
||||
|
||||
$sql7 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ADD COLUMN motor_marked_status TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql7);
|
||||
|
||||
$sql8 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ADD COLUMN pump_marked_status TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql8);
|
||||
|
||||
$sql9 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ADD COLUMN motor_pump_pumpset_status TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql9);
|
||||
|
||||
$sql10 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ADD COLUMN part_validation_1 TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql10);
|
||||
|
||||
$sql11 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ADD COLUMN part_validation_2 TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql11);
|
||||
|
||||
$sql12 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ADD COLUMN samlight_logged_name TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql12);
|
||||
|
||||
$sql13 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ADD COLUMN pending_released_status INTEGER DEFAULT 0
|
||||
SQL;
|
||||
|
||||
DB::statement($sql13);
|
||||
|
||||
$sql14 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ADD COLUMN expected_time TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql14);
|
||||
|
||||
$sql15 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ADD COLUMN machine_id BIGINT NOT NULL,
|
||||
ADD CONSTRAINT class_characteristics_machine_id_fkey
|
||||
FOREIGN KEY (machine_id) REFERENCES machines(id);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql15);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('class_characteristics', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE class_characteristics
|
||||
ALTER COLUMN marked_datetime TYPE TIMESTAMP USING marked_datetime::timestamp,
|
||||
ALTER COLUMN marked_datetime DROP DEFAULT,
|
||||
ALTER COLUMN man_marked_datetime TYPE TIMESTAMP USING man_marked_datetime::timestamp,
|
||||
ALTER COLUMN man_marked_datetime DROP DEFAULT
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('class_characteristics', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE ocr_validations (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
gr_number TEXT DEFAULT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (item_id) REFERENCES items(id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('ocr_validations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE invoice_data_validations (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
distribution_channel_desc TEXT DEFAULT NULL,
|
||||
customer_code TEXT DEFAULT NULL,
|
||||
document_number TEXT DEFAULT NULL,
|
||||
document_date DATE DEFAULT NULL,
|
||||
customer_trade_name TEXT DEFAULT NULL,
|
||||
customer_location TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('invoice_data_validations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE invoice_out_validations (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
qr_code TEXT DEFAULT NULL,
|
||||
scanned_at TIMESTAMP DEFAULT NULL,
|
||||
scanned_by TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('invoice_out_validations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE alert_mail_rules
|
||||
ADD COLUMN cc_emails TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('alert_mail_rules', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE invoice_data_validations
|
||||
ADD COLUMN location TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('invoice_data_validations', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE process_orders
|
||||
ADD COLUMN coil_number TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
ALTER TABLE process_orders
|
||||
ADD COLUMN order_quantity INT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
|
||||
$sql3 = <<<'SQL'
|
||||
ALTER TABLE process_orders
|
||||
ADD COLUMN received_quantity INT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('process_orders', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
ALTER TABLE process_orders
|
||||
ALTER COLUMN received_quantity TYPE NUMERIC
|
||||
USING received_quantity::NUMERIC;
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('process_orders', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE process_orders
|
||||
ADD COLUMN sfg_number TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
ALTER TABLE process_orders
|
||||
ADD COLUMN machine_name TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('process_orders', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE sticker_printings (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
reference_number TEXT DEFAULT NULL,
|
||||
serial_number TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sticker_printings');
|
||||
}
|
||||
};
|
||||
36
database/seeders/AdminSeeder.php
Normal file
36
database/seeders/AdminSeeder.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Hash;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AdminSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//updateOrCreate
|
||||
$user1 = User::updateOrCreate(
|
||||
// Unique identifier
|
||||
['email' => 'admin@cripumps.com'],
|
||||
|
||||
// Data to update/create
|
||||
[
|
||||
'name' => 'Admin',
|
||||
'password' => Hash::make('jOtHi$9000'),
|
||||
'updated_at' => now(),
|
||||
'created_at' => now()
|
||||
]
|
||||
);
|
||||
// $user1 = User::firstOrCreate([
|
||||
// 'name' => 'Admin',
|
||||
// 'email' => 'admin@cripumps.com',
|
||||
// 'password' => bcrypt('admin'),
|
||||
// ]);
|
||||
$user1->assignRole('Super Admin');
|
||||
}
|
||||
}
|
||||
20
database/seeders/DatabaseSeeder.php
Normal file
20
database/seeders/DatabaseSeeder.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->call(RoleSeeder::class);
|
||||
$this->call(AdminSeeder::class);
|
||||
$this->call(UserSeeder::class);
|
||||
$this->call(PermissionSeeder::class);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user