Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/dceprojects.corals.io/Corals/modules/Timesheet/database/migrations/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/dceprojects.corals.io/Corals/modules/Timesheet/database/migrations/TimesheetTables.php
<?php

namespace Corals\Modules\Timesheet\database\migrations;

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class TimesheetTables extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('ts_entries', function (Blueprint $table) {
            $table->increments('id');
            $table->date('spent_at')->index();
            $table->integer('hours');
            $table->integer('minutes');

            $table->text('description');

            $table->unsignedInteger('user_id');

            $table->foreign('user_id')
                ->references('id')
                ->on('users')
                ->restrictOnDelete()
                ->cascadeOnUpdate();

            $table->string('department_code')->nullable();

            $table->foreign('department_code')
                ->references('code')
                ->on('utility_list_of_values')
                ->nullOnDelete();


            $table->morphs('entrieable');


            $table->unsignedInteger('created_by')->nullable()->index();
            $table->unsignedInteger('updated_by')->nullable()->index();

            $table->text('properties')->nullable();

            $table->softDeletes();
            $table->timestamps();
        });

        Schema::create('ts_jobs', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->string('number');
            $table->integer('hours_per_employee');

            $table->date('starts_at')->nullable();
            $table->date('ends_at')->nullable();
            $table->unsignedInteger('created_by')->nullable()->index();
            $table->unsignedInteger('updated_by')->nullable()->index();


            $table->timestamps();
        });

        Schema::create('ts_department_job', function (Blueprint $table) {
            $table->increments('id');
            $table->foreignId('job_id')->constrained('ts_jobs')->cascadeOnDelete()->cascadeOnUpdate();
            $table->string('department_code');
            $table->integer('hours');
            $table->foreign('department_code')
                ->references('code')
                ->on('utility_list_of_values')->cascadeOnDelete()->cascadeOnUpdate();

            $table->unique(['job_id', 'department_code']);
            $table->timestamps();
        });

        Schema::table('users', function (Blueprint $table) {
            $table->string('department_code')->nullable();

            $table->foreign('department_code')
                ->references('code')
                ->on('utility_list_of_values')
                ->nullOnDelete();
        });

    }


    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('ts_entries');
        Schema::dropIfExists('ts_jobs');
        Schema::dropIfExists('ts_department_job');

        Schema::table('users', function (Blueprint $table) {
            $table->dropForeign(['department_code']);
            $table->dropColumn('department_code');
        });
    }
}

Spamworldpro Mini