migrations akses pasar

This commit is contained in:
2026-07-01 11:11:12 +07:00
parent 839e9aa572
commit cc6a732de7
@@ -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
{
Schema::create('akses_pasar', function (Blueprint $table) {
$table->id();
$table -> string ('uid')->nullable()->unique();
$table->foreignId('petani_id')->nullable()->constrained('petani')->onDelete('cascade');
$table->tinyInteger('skor_pengalaman')->nullable()->comment('Skala 1-5');
$table->json('saluran_terdahulu')->nullable()->comment('Menyimpan opsi Many (Koperasi, BUMDes, dll)');
$table->string('saluran_terdahulu_lainnya')->nullable();
$table->string('alasan_berhenti')->nullable();
$table->string('praktik_fermentasi')->nullable();
$table->text('proses_fermentasi')->nullable();
$table->string('model_fermentasi_memungkinkan')->nullable();
$table->tinyInteger('skor_kesadaran_premium')->nullable()->comment('Skala 1-5');
$table->string('sumber_info_premium')->nullable();
$table->time('waktu_mulai_wawancara')->nullable();
$table->time('waktu_selesai_wawancara')->nullable();
$table->tinyInteger('skor_kepercayaan_responden')->nullable()->comment('Skala 1-5');
$table->string('kehadiran_orang_lain')->nullable()->comment('Nama/siapa yang hadir mendampingi');
$table->tinyInteger('skor_pengaruh_orang_lain')->nullable()->comment('Skala 1-5');
$table ->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
$table ->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
$table ->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
$table->timestamps();
$table->softDeletes();
});
Schema::create('harga_jual_panen', function (Blueprint $table) {
$table->id();
$table -> string ('uid')->nullable()->unique();
$table->foreignId('petani_id')->constrained('petani')->onDelete('cascade');
$table->string('bentuk_produk');
$table->integer('harga_panen_terakhir')->nullable();
$table->integer('harga_tahun_lalu')->nullable();
$table->integer('harga_dua_tahun_lalu')->nullable();
$table ->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
$table ->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
$table ->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('akses_pasar');
Schema::dropIfExists('harga_jual_panen');
}
};