create all azmayesh resources and its dependencies

This commit is contained in:
2024-10-22 16:40:36 +03:30
parent 9aa3cf320f
commit c2ceb3d343
20 changed files with 548 additions and 0 deletions

View File

@@ -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('azmayesh_fields', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('unit');
$table->string('type');
$table->string('option')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('azmayesh_fields');
}
};

View File

@@ -0,0 +1,28 @@
<?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('azmayesh_types', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('azmayesh_types');
}
};

View File

@@ -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
{
Schema::create('azmayeshes', function (Blueprint $table) {
$table->id();
$table->foreignId('azmayesh_type_id')->constrained('azmayesh_types');
$table->string('azmayesh_type_name');
$table->string('lat');
$table->string('lng');
$table->foreignId('province_id')->constrained('provinces');
$table->string('province_name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('azmayeshes');
}
};

View File

@@ -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('azmayesh_samples', function (Blueprint $table) {
$table->id();
$table->foreignId('azmayesh_id')->constrained('azmayeshes');
$table->string('azmayesh_name');
$table->json('data');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('azmayesh_samples');
}
};

View File

@@ -0,0 +1,29 @@
<?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('azmayesh_field_azmayesh_type', function (Blueprint $table) {
$table->id();
$table->foreignId('azmayesh_field_id')->constrained('azmayesh_fields');
$table->foreignId('azmayesh_type_id')->constrained('azmayesh_types');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('azmayesh_field_azmayesh_type');
}
};