Tables migration, seeders, db dump, README.md
This commit is contained in:
@@ -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
|
||||
{
|
||||
Schema::create('clubs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name_ru');
|
||||
$table->string('name_en');
|
||||
$table->string('city_ru');
|
||||
$table->string('city_en');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('clubs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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('players', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('full_name_ru');
|
||||
$table->string('full_name_en');
|
||||
$table->unsignedInteger('weight');
|
||||
$table->unsignedInteger('height');
|
||||
$table->tinyInteger('squad_number');
|
||||
$table->foreignIdFor(\App\Models\Club::class)
|
||||
->constrained()
|
||||
->onUpdate('cascade')
|
||||
->onDelete('restrict');
|
||||
|
||||
$table->unique(['club_id', 'squad_number']);
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('players');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user