%PDF- %PDF-
Direktori : /var/www/html/hrsys/api/database/migrations/ |
Current File : /var/www/html/hrsys/api/database/migrations/2020_04_13_101527_create_maintenance_payments_table.php |
<?php use App\Models\MaintenancePayment; use App\Models\Project; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateMaintenancePaymentsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('maintenance_payments', function (Blueprint $table) { $table->id(); $table->string('name'); $table->string('description') ->nullable(); $table->string('type') ->default(MaintenancePayment::EARNING); $table->decimal('amount', 12, 2); $table->string('currency') ->default(Project::EURO); $table->integer('cycle'); $table->date('start_date'); $table->date('next_payment_date'); $table->boolean('is_active'); $table->unsignedBigInteger('client_id') ->index(); $table->foreign('client_id') ->references('id') ->on('clients'); $table->dateTime('canceled_at') ->nullable(); $table->timestamps(); }); Schema::create('maintenance_payment_transactions', function (Blueprint $table) { $table->id(); $table->decimal('amount', 12, 2); $table->string('currency') ->default(Project::EURO); $table->date('paid_at'); $table->unsignedBigInteger('payment_id') ->index(); $table->foreign('payment_id') ->references('id') ->on('maintenance_payments'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('maintenance_payment_transactions'); Schema::dropIfExists('maintenance_payments'); } }