From d7603c07fdb80f40240311af7d4db0704dd0b680 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Mon, 17 Aug 2020 11:43:37 +0200 Subject: [PATCH] Merge branch 'master' of https://git.wmi.amu.edu.pl/s421507/eOSP2 # Conflicts: # .idea/workspace.xml Signed-off-by: Krzysztof Strzelecki --- .../2014_10_12_000000_create_users_table.php | 44 ++++++++++++----- ..._13_220544_create__fire_stations_table.php | 29 ++++++----- ...19_09_19_113737_jednostki_terytorialne.php | 49 ------------------- .../2019_10_05_185538_create_ranks_table.php | 13 +---- ...0_05_215707_create_unitFunctions_table.php | 16 ++---- ...019_11_07_230105_create_vehicles_table.php | 45 +++++++++-------- ...9_11_12_235707_create_operations_table.php | 16 +++--- ...6_195559_create_operationsTrucks_table.php | 13 +++-- ..._195646_create_operationsMembers_table.php | 12 +++-- ...station_i_d_column_to_operations_table.php | 33 ------------- ...19_12_05_185219_create_equipment_table.php | 10 ++-- ...19_12_11_214115_create_trainings_table.php | 6 ++- ...445_create_trainingsFirefighters_table.php | 15 +++--- ...d_softdelete_column_to_trainings_table.php | 32 ------------ ...28_165307_add_status_to_vehicles_table.php | 33 ------------- ..._12_31_001536_create_decorations_table.php | 17 ++----- ...6_create_decorationsFirefighters_table.php | 15 +++--- ...add_trainings_necessary_for_operations.php | 35 ------------- ...add_additional_data_about_firefighters.php | 47 ------------------ ...0_08_02_163347_create_provinces_table.php} | 11 ++--- ...20_08_02_163410_create_districts_table.php | 33 +++++++++++++ ...020_08_02_163532_create_communes_table.php | 35 +++++++++++++ ...add_trainings_necessary_for_operations.php | 35 ------------- ...add_additional_data_about_firefighters.php | 47 ------------------ 24 files changed, 206 insertions(+), 435 deletions(-) delete mode 100644 database/migrations/2019_09_19_113737_jednostki_terytorialne.php delete mode 100644 database/migrations/2019_11_27_113757_add_fire_station_i_d_column_to_operations_table.php delete mode 100644 database/migrations/2019_12_12_042400_add_softdelete_column_to_trainings_table.php delete mode 100644 database/migrations/2019_12_28_165307_add_status_to_vehicles_table.php delete mode 100644 database/migrations/2020_02_27_134925_add_trainings_necessary_for_operations.php delete mode 100644 database/migrations/2020_07_19_203706_add_additional_data_about_firefighters.php rename database/migrations/{2020_01_22_004052_add_soft_deletes_to_operations_table.php => 2020_08_02_163347_create_provinces_table.php} (60%) create mode 100644 database/migrations/2020_08_02_163410_create_districts_table.php create mode 100644 database/migrations/2020_08_02_163532_create_communes_table.php delete mode 100644 database/migrations/a/2020_02_27_134925_add_trainings_necessary_for_operations.php delete mode 100644 database/migrations/a/2020_07_19_203706_add_additional_data_about_firefighters.php diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index c7e1f21..6bc7205 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -15,25 +15,43 @@ class CreateUsersTable extends Migration { Schema::create('users', function (Blueprint $table) { $table->increments('id'); - $table->string('password', 100); - $table->string('name', 45); - $table->string('surname', 45); + $table->string('password'); + $table->string('name'); + $table->string('surname'); $table->string('PESEL',11); - $table->string('phoneNumber', 9); - $table->string('email', 50)->unique(); - $table->integer('fireStationID')->nullable(); - $table->integer('functionID'); - $table->integer('degreeID'); - $table->string('number', 45)->nullable()->default(null); - $table->integer('statusID')->default(0); - $table->integer('deleted')->default(0); - $table->integer('creatorID')->nullable()->default(null); - $table->integer('changingID')->nullable()->default(null); + $table->string('phoneNumber', 20); + $table->string('email', 100)->unique(); + $table->integer('fire_station_id')->unsigned()->nullable(); + $table->foreign('fire_station_id')->references('id')->on('fire_stations')->onDelete('cascade'); + $table->integer('unit_function_id')->unsigned()->nullable(); + $table->foreign('unit_function_id')->references('id')->on('unit_functions')->onDelete('set null'); + $table->integer('rank_id')->unsigned()->nullable(); + $table->foreign('rank_id')->references('id')->on('ranks')->onDelete('set null'); + $table->string('number')->nullable()->default(null); + $table->string('second_name')->nullable()->default(null); + $table->string('fathers_name')->nullable()->default(null); + $table->string('mothers_name')->nullable()->default(null); + $table->string('address')->nullable()->default(null); + $table->string('apartment')->nullable()->default(null); //nr domu + $table->string('place_of_birth')->nullable()->default(null); + $table->string('drivers_license')->nullable()->default(null); + $table->date('joining_osp_date')->nullable()->default(null); + $table->string('id_series', 3)->nullable()->default(null); + $table->string('id_number', 6)->nullable()->default(null); //nr dowodu osobistego + $table->date('id_valid_until')->nullable()->default(null); + $table->string('identity_card_number')->nullable()->default(null); //nr legitymacji strażackiej + $table->string('home_phone_number', 20)->nullable()->default(null); + $table->string('education')->nullable()->default(null); + $table->string('profession')->nullable()->default(null); + $table->integer('status_id')->default(0); //aktywny/zawieszony + $table->integer('creator_id')->nullable()->default(null); + $table->integer('editor_id')->nullable()->default(null); $table->boolean('confirmed')->default(0); $table->string('confirmation_code')->nullable(); $table->timestamp('email_verified_at')->nullable(); $table->rememberToken(); $table->timestamps(); + $table->softDeletes(); }); } diff --git a/database/migrations/2019_09_13_220544_create__fire_stations_table.php b/database/migrations/2019_09_13_220544_create__fire_stations_table.php index 443501d..588c78f 100644 --- a/database/migrations/2019_09_13_220544_create__fire_stations_table.php +++ b/database/migrations/2019_09_13_220544_create__fire_stations_table.php @@ -13,25 +13,28 @@ class CreateFireStationsTable extends Migration */ public function up() { - Schema::create('fireStations', function (Blueprint $table) { + Schema::create('fire_stations', function (Blueprint $table) { $table->increments('id'); - $table->string('name', 45); + $table->string('name'); $table->integer('number'); - $table->string('voivodeship', 45); - $table->string('county', 45); - $table->string('community', 45); - $table->string('postOffice', 45); - $table->string('zipCode', 6); - $table->string('address', 45); + $table->integer('province_id')->unsigned(); + $table->foreign('province_id')->references('id')->on('provinces'); + $table->integer('district_id')->unsigned(); + $table->foreign('district_id')->references('id')->on('districts'); + $table->integer('commune_id')->unsigned(); + $table->foreign('commune_id')->references('id')->on('communes'); + $table->string('post_office'); + $table->string('zip_code'); + $table->string('address'); $table->float('latitude', 9,5); $table->float('longitude', 9,5); $table->string('KRS', 10); $table->string('NIP', 10); - $table->string('phoneNumber', 11); - $table->string('email', 100); + $table->string('phone_number', 20); + $table->string('email'); $table->integer('deleted')->default(0); - $table->integer('creatorID')->nullable()->default(null); - $table->integer('changingID')->nullable()->default(null); + $table->integer('creator_id')->nullable()->default(null); + $table->integer('editor_id')->nullable()->default(null); $table->rememberToken(); $table->timestamps(); }); @@ -44,6 +47,6 @@ class CreateFireStationsTable extends Migration */ public function down() { - Schema::dropIfExists('fireStations'); + Schema::dropIfExists('fire_stations'); } } diff --git a/database/migrations/2019_09_19_113737_jednostki_terytorialne.php b/database/migrations/2019_09_19_113737_jednostki_terytorialne.php deleted file mode 100644 index 12191a6..0000000 --- a/database/migrations/2019_09_19_113737_jednostki_terytorialne.php +++ /dev/null @@ -1,49 +0,0 @@ -increments('id'); - $table->integer('id'); - $table->string('name'); - }); - - Schema::create('powiaty', function (Blueprint $table) { - $table->integer('id'); - $table->integer('wojewodztwo_id'); - $table->string('name'); - }); - - Schema::create('gminy', function (Blueprint $table) { - $table->integer('id'); - $table->integer('wojewodztwo_id'); - $table->integer('powiat_id'); - $table->string('name'); - }); - - - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('wojewodztwa'); - Schema::dropIfExists('powiaty'); - Schema::dropIfExists('gminy'); - } -} diff --git a/database/migrations/2019_10_05_185538_create_ranks_table.php b/database/migrations/2019_10_05_185538_create_ranks_table.php index dab8965..fcda869 100644 --- a/database/migrations/2019_10_05_185538_create_ranks_table.php +++ b/database/migrations/2019_10_05_185538_create_ranks_table.php @@ -14,18 +14,9 @@ class CreateRanksTable extends Migration public function up() { Schema::create('ranks', function (Blueprint $table) { - $table->integer('id'); - $table->string('rank', 60); + $table->increments('id'); + $table->string('rank'); }); - - - DB::table('ranks')->insert([ 'id' => '1', 'rank' => 'strażak' ]); - DB::table('ranks')->insert([ 'id' => '2', 'rank' => 'starszy strażak' ]); - DB::table('ranks')->insert([ 'id' => '3', 'rank' => 'dowódca roty' ]); - DB::table('ranks')->insert([ 'id' => '4', 'rank' => 'pomocnik dowódcy sekcji' ]); - DB::table('ranks')->insert([ 'id' => '5', 'rank' => 'dowódca sekcji' ]); - DB::table('ranks')->insert([ 'id' => '6', 'rank' => 'pomocnik dowódcy plutonu' ]); - DB::table('ranks')->insert([ 'id' => '7', 'rank' => 'dowódca plutonu' ]); } /** diff --git a/database/migrations/2019_10_05_215707_create_unitFunctions_table.php b/database/migrations/2019_10_05_215707_create_unitFunctions_table.php index 6416a05..643832c 100644 --- a/database/migrations/2019_10_05_215707_create_unitFunctions_table.php +++ b/database/migrations/2019_10_05_215707_create_unitFunctions_table.php @@ -13,18 +13,10 @@ class CreateUnitFunctionsTable extends Migration */ public function up() { - Schema::create('unitFunctions', function (Blueprint $table) { - $table->integer('id'); - $table->string('unitFunction', 60); + Schema::create('unit_functions', function (Blueprint $table) { + $table->increments('id'); + $table->string('unit_function'); }); - - DB::table('unitFunctions')->insert([ 'id' => '1', 'unitFunction' => 'naczelnik' ]); - DB::table('unitFunctions')->insert([ 'id' => '2', 'unitFunction' => 'zastępca naczelnika' ]); - DB::table('unitFunctions')->insert([ 'id' => '3', 'unitFunction' => 'skarbnik' ]); - DB::table('unitFunctions')->insert([ 'id' => '4', 'unitFunction' => 'sekretarz' ]); - DB::table('unitFunctions')->insert([ 'id' => '5', 'unitFunction' => 'prezes' ]); - DB::table('unitFunctions')->insert([ 'id' => '6', 'unitFunction' => 'przewodniczący komisji rewizyjnej' ]); - DB::table('unitFunctions')->insert([ 'id' => '7', 'unitFunction' => 'członek komisji rewizyjnej' ]); } /** @@ -34,6 +26,6 @@ class CreateUnitFunctionsTable extends Migration */ public function down() { - Schema::dropIfExists('unitFunctions'); + Schema::dropIfExists('unit_functions'); } } diff --git a/database/migrations/2019_11_07_230105_create_vehicles_table.php b/database/migrations/2019_11_07_230105_create_vehicles_table.php index a56ee75..16ab42f 100644 --- a/database/migrations/2019_11_07_230105_create_vehicles_table.php +++ b/database/migrations/2019_11_07_230105_create_vehicles_table.php @@ -15,29 +15,32 @@ class CreateVehiclesTable extends Migration { Schema::create('vehicles', function (Blueprint $table) { $table->increments('id'); - $table->integer('fireStationID'); - $table->string('name', 45); - $table->string('codename', 45); - $table->string('brand',45)->nullable(); - $table->string('registrationNumber', 15)->nullable(); - $table->integer('productionYear')->nullable(); - $table->date('examExpirationDate')->nullable(); //Data ważności przegladu - $table->date('insuranceExpirationDate')->nullable(); - $table->string('driveType',45)->nullable(); //układ napędowy - $table->string('chassisType',45)->nullable(); //typ podwozia - $table->string('bodyProducer',45)->nullable(); //producent nadwozia - $table->integer('crewNumber')->nullable(); - $table->integer('foamAgent')->nullable(); //Ilość środka pianotwórczego w litrach - $table->integer('enginePower')->nullable(); //Moc silnika w kW + $table->integer('fire_station_id')->unsigned(); + $table->foreign('fire_station_id')->references('id')->on('fire_stations')->onDelete('cascade'); + $table->string('name'); + $table->string('codename'); + $table->string('brand')->nullable(); + $table->string('registration_number', 20)->nullable(); + $table->integer('production_year')->nullable(); + $table->date('exam_expiration_date')->nullable(); //Data ważności przegladu + $table->date('insurance_expiration_date')->nullable(); + $table->string('drive_type')->nullable(); //układ napędowy + $table->string('chassis_type')->nullable(); //typ podwozia + $table->string('body_producer')->nullable(); //producent nadwozia + $table->integer('crew_number')->nullable(); + $table->integer('foam_agent')->nullable(); //Ilość środka pianotwórczego w litrach + $table->integer('engine_power')->nullable(); //Moc silnika w kW $table->integer('mass')->nullable(); //Masa całkowita pojazdu - $table->string('chassisNumber')->nullable(); - $table->string('engineNumber')->nullable(); - $table->string('fuelType',45)->nullable(); - $table->integer('chassisPoductionYear')->nullable(); - $table->date('entryIntoServiceDate')->nullable(); - $table->string('fireEnginePumpDescription')->nullable();// Opis autopompy - $table->softDeletes(); + $table->string('chassis_number')->nullable(); + $table->string('engine_number')->nullable(); + $table->string('fuel_type')->nullable(); + $table->integer('chassis_poduction_year')->nullable(); + $table->date('entry_into_service_date')->nullable(); + $table->string('fire_engine_pump_description')->nullable();// Opis autopompy + $table->integer('status')->default('0'); + $table->integer('editor_id')->nullable()->default(null); $table->timestamps(); + $table->softDeletes(); }); } diff --git a/database/migrations/2019_11_12_235707_create_operations_table.php b/database/migrations/2019_11_12_235707_create_operations_table.php index 14c7724..2766d1b 100644 --- a/database/migrations/2019_11_12_235707_create_operations_table.php +++ b/database/migrations/2019_11_12_235707_create_operations_table.php @@ -15,14 +15,18 @@ class CreateOperationsTable extends Migration { Schema::create('operations', function (Blueprint $table) { $table->increments('id'); - $table->dateTime('operationDate'); - $table->string('location', 100); - $table->string('target', 100); - $table->string('dangerType', 100); + $table->integer('fire_station_id')->unsigned(); + $table->foreign('fire_station_id')->references('id')->on('fire_stations')->onDelete('cascade'); + $table->dateTime('operation_date'); + $table->string('location'); + $table->string('target'); + $table->string('danger_type'); $table->longtext('description'); - $table->integer('commanderID'); - $table->softDeletes(); + $table->integer('commander_id')->unsigned(); + $table->foreign('commander_id')->references('id')->on('users'); + $table->integer('editor_id')->nullable()->default(null); $table->timestamps(); + $table->softDeletes(); }); } diff --git a/database/migrations/2019_11_16_195559_create_operationsTrucks_table.php b/database/migrations/2019_11_16_195559_create_operationsTrucks_table.php index 65759b9..0d9122f 100644 --- a/database/migrations/2019_11_16_195559_create_operationsTrucks_table.php +++ b/database/migrations/2019_11_16_195559_create_operationsTrucks_table.php @@ -13,11 +13,14 @@ class CreateOperationsTrucksTable extends Migration */ public function up() { - Schema::create('operationsTrucks', function (Blueprint $table) { + Schema::create('operations_vehicles', function (Blueprint $table) { $table->increments('id'); - $table->integer('operationID'); - $table->integer('truckID'); - $table->integer('driverID'); + $table->integer('operation_id')->unsigned(); + $table->foreign('operation_id')->references('id')->on('operations')->onDelete('cascade'); + $table->integer('vehicle_id')->unsigned(); + $table->foreign('vehicle_id')->references('id')->on('vehicles'); + $table->integer('driver_id')->unsigned(); + $table->foreign('driver_id')->references('id')->on('users'); $table->timestamps(); }); } @@ -29,6 +32,6 @@ class CreateOperationsTrucksTable extends Migration */ public function down() { - Schema::dropIfExists('operationsTrucks'); + Schema::dropIfExists('operations_vehicles'); } } diff --git a/database/migrations/2019_11_16_195646_create_operationsMembers_table.php b/database/migrations/2019_11_16_195646_create_operationsMembers_table.php index 7708e05..5d2fd10 100644 --- a/database/migrations/2019_11_16_195646_create_operationsMembers_table.php +++ b/database/migrations/2019_11_16_195646_create_operationsMembers_table.php @@ -13,11 +13,13 @@ class CreateOperationsMembersTable extends Migration */ public function up() { - Schema::create('operationsMembers', function (Blueprint $table) { + Schema::create('operations_members', function (Blueprint $table) { $table->increments('id'); - $table->integer('operationID'); - $table->integer('memberID'); - $table->boolean('privateTransport'); + $table->integer('operation_id')->unsigned(); + $table->foreign('operation_id')->references('id')->on('operations')->onDelete('cascade'); + $table->integer('member_id')->unsigned(); + $table->foreign('member_id')->references('id')->on('users'); + $table->boolean('private_transport'); $table->timestamps(); }); } @@ -29,6 +31,6 @@ class CreateOperationsMembersTable extends Migration */ public function down() { - Schema::dropIfExists('operationsMembers'); + Schema::dropIfExists('operations_members'); } } diff --git a/database/migrations/2019_11_27_113757_add_fire_station_i_d_column_to_operations_table.php b/database/migrations/2019_11_27_113757_add_fire_station_i_d_column_to_operations_table.php deleted file mode 100644 index aa2c040..0000000 --- a/database/migrations/2019_11_27_113757_add_fire_station_i_d_column_to_operations_table.php +++ /dev/null @@ -1,33 +0,0 @@ -integer('fireStationID'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('operations', function (Blueprint $table) { - // - }); - } -} diff --git a/database/migrations/2019_12_05_185219_create_equipment_table.php b/database/migrations/2019_12_05_185219_create_equipment_table.php index 46ee0d0..027f208 100644 --- a/database/migrations/2019_12_05_185219_create_equipment_table.php +++ b/database/migrations/2019_12_05_185219_create_equipment_table.php @@ -15,12 +15,14 @@ class CreateEquipmentTable extends Migration { Schema::create('equipment', function (Blueprint $table) { $table->increments('id'); - $table->integer('fireStationID'); - $table->string('name', 45); + $table->integer('fire_station_id')->unsigned(); + $table->foreign('fire_station_id')->references('id')->on('fire_stations')->onDelete('cascade'); + $table->string('name'); $table->integer('amount'); - $table->string('parameter', 45)->nullable(); - $table->softDeletes(); + $table->string('parameter')->nullable(); + $table->integer('editor_id')->nullable()->default(null); $table->timestamps(); + $table->softDeletes(); }); } diff --git a/database/migrations/2019_12_11_214115_create_trainings_table.php b/database/migrations/2019_12_11_214115_create_trainings_table.php index 32a1df5..0058a19 100644 --- a/database/migrations/2019_12_11_214115_create_trainings_table.php +++ b/database/migrations/2019_12_11_214115_create_trainings_table.php @@ -15,9 +15,11 @@ class CreateTrainingsTable extends Migration { Schema::create('trainings', function (Blueprint $table) { $table->increments('id'); - $table->integer('fireStationID'); - $table->string('trainingName'); + $table->integer('fire_station_id')->unsigned()->nullable(); + $table->foreign('fire_station_id')->references('id')->on('fire_stations')->onDelete('cascade'); + $table->string('training_name'); $table->timestamps(); + $table->softDeletes(); }); } diff --git a/database/migrations/2019_12_11_214445_create_trainingsFirefighters_table.php b/database/migrations/2019_12_11_214445_create_trainingsFirefighters_table.php index 3573e55..7eb8491 100644 --- a/database/migrations/2019_12_11_214445_create_trainingsFirefighters_table.php +++ b/database/migrations/2019_12_11_214445_create_trainingsFirefighters_table.php @@ -13,13 +13,16 @@ class CreateTrainingsFireFightersTable extends Migration */ public function up() { - Schema::create('trainingsFirefighters', function (Blueprint $table) { + Schema::create('trainings_firefighters', function (Blueprint $table) { $table->increments('id'); - $table->integer('firefighterID'); - $table->integer('trainingID'); - $table->date('dateOfComplete'); - $table->date('dateOfExpiry'); + $table->integer('user_id')->unsigned(); + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + $table->integer('training_id')->unsigned(); + $table->foreign('training_id')->references('id')->on('trainings')->onDelete('cascade'); + $table->date('date_of_completion'); + $table->date('date_of_expiry'); $table->boolean('lifetime'); + $table->integer('editor_id')->nullable()->default(null); $table->timestamps(); }); } @@ -31,6 +34,6 @@ class CreateTrainingsFireFightersTable extends Migration */ public function down() { - Schema::dropIfExists('trainingsFirefighters'); + Schema::dropIfExists('trainings_firefighters'); } } diff --git a/database/migrations/2019_12_12_042400_add_softdelete_column_to_trainings_table.php b/database/migrations/2019_12_12_042400_add_softdelete_column_to_trainings_table.php deleted file mode 100644 index ae65358..0000000 --- a/database/migrations/2019_12_12_042400_add_softdelete_column_to_trainings_table.php +++ /dev/null @@ -1,32 +0,0 @@ -softDeletes(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('trainings', function (Blueprint $table) { - // - }); - } -} diff --git a/database/migrations/2019_12_28_165307_add_status_to_vehicles_table.php b/database/migrations/2019_12_28_165307_add_status_to_vehicles_table.php deleted file mode 100644 index 2c4b226..0000000 --- a/database/migrations/2019_12_28_165307_add_status_to_vehicles_table.php +++ /dev/null @@ -1,33 +0,0 @@ -integer('status')->default('0'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('vehicles', function (Blueprint $table) { - // - }); - } -} diff --git a/database/migrations/2019_12_31_001536_create_decorations_table.php b/database/migrations/2019_12_31_001536_create_decorations_table.php index 67971a6..f8afd57 100644 --- a/database/migrations/2019_12_31_001536_create_decorations_table.php +++ b/database/migrations/2019_12_31_001536_create_decorations_table.php @@ -14,20 +14,9 @@ class CreateDecorationsTable extends Migration public function up() { Schema::create('decorations', function (Blueprint $table) { - $table->integer('id'); - $table->string('decorationName'); - }); - - DB::table('decorations')->insert([ 'id' => '1', 'decorationName' => 'Odznaka "Młodzieżowa Drużyna Pożarnicza" - brązowa' ]); - DB::table('decorations')->insert([ 'id' => '2', 'decorationName' => 'Odznaka "Młodzieżowa Drużyna Pożarnicza" - srebrna' ]); - DB::table('decorations')->insert([ 'id' => '3', 'decorationName' => 'Odznaka "Młodzieżowa Drużyna Pożarnicza" - złota' ]); - DB::table('decorations')->insert([ 'id' => '4', 'decorationName' => 'Odznaka "Za wysługę lat"' ]); - DB::table('decorations')->insert([ 'id' => '5', 'decorationName' => 'Odznaka "Strażak Wzorowy"' ]); - DB::table('decorations')->insert([ 'id' => '6', 'decorationName' => 'Medal "Za Zasługi dla Pożarnictwa" - brązowy' ]); - DB::table('decorations')->insert([ 'id' => '7', 'decorationName' => 'Medal "Za Zasługi dla Pożarnictwa" - srebrny' ]); - DB::table('decorations')->insert([ 'id' => '8', 'decorationName' => 'Medal "Za Zasługi dla Pożarnictwa" - złoty' ]); - DB::table('decorations')->insert([ 'id' => '9', 'decorationName' => 'Medal Honorowy im. Bolesława Chomicza' ]); - DB::table('decorations')->insert([ 'id' => '10', 'decorationName' => 'Złoty Znak Związku Ochotniczych Straży Pożarnych Rzeczypospolitej Polskiej' ]); + $table->increments('id'); + $table->string('decoration_name'); + }); } /** diff --git a/database/migrations/2019_12_31_003036_create_decorationsFirefighters_table.php b/database/migrations/2019_12_31_003036_create_decorationsFirefighters_table.php index 1ea2e5c..dfacd5c 100644 --- a/database/migrations/2019_12_31_003036_create_decorationsFirefighters_table.php +++ b/database/migrations/2019_12_31_003036_create_decorationsFirefighters_table.php @@ -13,13 +13,16 @@ class CreateDecorationsFirefightersTable extends Migration */ public function up() { - Schema::create('decorationsFirefighters', function (Blueprint $table) { + Schema::create('decorations_firefighters', function (Blueprint $table) { $table->increments('id'); - $table->integer('firefighterID'); - $table->integer('decorationID'); - $table->date('dateOfAward'); - $table->softDeletes(); + $table->integer('user_id')->unsigned(); + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + $table->integer('decoration_id')->unsigned(); + $table->foreign('decoration_id')->references('id')->on('decorations')->onDelete('cascade'); + $table->date('date_of_award'); + $table->integer('editor_id')->nullable()->default(null); $table->timestamps(); + $table->softDeletes(); }); } @@ -30,6 +33,6 @@ class CreateDecorationsFirefightersTable extends Migration */ public function down() { - Schema::dropIfExists('decorationsFirefighters'); + Schema::dropIfExists('decorations_firefighters'); } } diff --git a/database/migrations/2020_02_27_134925_add_trainings_necessary_for_operations.php b/database/migrations/2020_02_27_134925_add_trainings_necessary_for_operations.php deleted file mode 100644 index ec84c54..0000000 --- a/database/migrations/2020_02_27_134925_add_trainings_necessary_for_operations.php +++ /dev/null @@ -1,35 +0,0 @@ -insert([ 'id' => '1', 'fireStationID' => '0', 'trainingName' => 'szkolenie podstawowe' ]); - DB::table('trainings')->insert([ 'id' => '2', 'fireStationID' => '0', 'trainingName' => 'dowódca' ]); - DB::table('trainings')->insert([ 'id' => '3', 'fireStationID' => '0', 'trainingName' => 'kierowca-mechanik' ]); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('trainings', function (Blueprint $table) { - // - }); - } -} \ No newline at end of file diff --git a/database/migrations/2020_07_19_203706_add_additional_data_about_firefighters.php b/database/migrations/2020_07_19_203706_add_additional_data_about_firefighters.php deleted file mode 100644 index bb8da60..0000000 --- a/database/migrations/2020_07_19_203706_add_additional_data_about_firefighters.php +++ /dev/null @@ -1,47 +0,0 @@ -string('secondName', 45)->nullable()->default(null); - $table->string('fathersName', 45)->nullable()->default(null); - $table->string('mothersName', 45)->nullable()->default(null); - $table->string('address', 45)->nullable()->default(null); - $table->string('apartment', 45)->nullable()->default(null); //nr domu - $table->string('placeOfBirth', 45)->nullable()->default(null); - $table->string('driversLicense', 20)->nullable()->default(null); - $table->date('joiningOSPDate', 20)->nullable()->default(null); - $table->string('IDSeries', 3)->nullable()->default(null); - $table->string('IDNumber', 6)->nullable()->default(null); //nr dowodu osobistego - $table->date('IDValidUntil', 20)->nullable()->default(null); - $table->string('identityCardNumber', 20)->nullable()->default(null); //nr legitymacji strażackiej - $table->string('homePhoneNumber', 20)->nullable()->default(null); - $table->string('education', 45)->nullable()->default(null); - $table->string('profession', 45)->nullable()->default(null); - - - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - // - } -} diff --git a/database/migrations/2020_01_22_004052_add_soft_deletes_to_operations_table.php b/database/migrations/2020_08_02_163347_create_provinces_table.php similarity index 60% rename from database/migrations/2020_01_22_004052_add_soft_deletes_to_operations_table.php rename to database/migrations/2020_08_02_163347_create_provinces_table.php index ed4c79f..a495339 100644 --- a/database/migrations/2020_01_22_004052_add_soft_deletes_to_operations_table.php +++ b/database/migrations/2020_08_02_163347_create_provinces_table.php @@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class AddSoftDeletesToOperationsTable extends Migration +class CreateProvincesTable extends Migration { /** * Run the migrations. @@ -13,8 +13,9 @@ class AddSoftDeletesToOperationsTable extends Migration */ public function up() { - Schema::table('operations', function (Blueprint $table) { - $table->softDeletes(); + Schema::create('provinces', function (Blueprint $table) { + $table->increments('id'); + $table->string('name'); }); } @@ -25,8 +26,6 @@ class AddSoftDeletesToOperationsTable extends Migration */ public function down() { - Schema::table('operations', function (Blueprint $table) { - // - }); + Schema::dropIfExists('provinces'); } } diff --git a/database/migrations/2020_08_02_163410_create_districts_table.php b/database/migrations/2020_08_02_163410_create_districts_table.php new file mode 100644 index 0000000..45f4257 --- /dev/null +++ b/database/migrations/2020_08_02_163410_create_districts_table.php @@ -0,0 +1,33 @@ +increments('id'); + $table->integer('province_id')->unsigned(); + $table->foreign('province_id')->references('id')->on('provinces')->onDelete('cascade'); + $table->string('name'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('districts'); + } +} diff --git a/database/migrations/2020_08_02_163532_create_communes_table.php b/database/migrations/2020_08_02_163532_create_communes_table.php new file mode 100644 index 0000000..76a118d --- /dev/null +++ b/database/migrations/2020_08_02_163532_create_communes_table.php @@ -0,0 +1,35 @@ +increments('id'); + $table->integer('province_id')->unsigned(); + $table->foreign('province_id')->references('id')->on('provinces')->onDelete('cascade'); + $table->integer('district_id')->unsigned(); + $table->foreign('district_id')->references('id')->on('districts')->onDelete('cascade'); + $table->string('name'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('communes'); + } +} diff --git a/database/migrations/a/2020_02_27_134925_add_trainings_necessary_for_operations.php b/database/migrations/a/2020_02_27_134925_add_trainings_necessary_for_operations.php deleted file mode 100644 index ec84c54..0000000 --- a/database/migrations/a/2020_02_27_134925_add_trainings_necessary_for_operations.php +++ /dev/null @@ -1,35 +0,0 @@ -insert([ 'id' => '1', 'fireStationID' => '0', 'trainingName' => 'szkolenie podstawowe' ]); - DB::table('trainings')->insert([ 'id' => '2', 'fireStationID' => '0', 'trainingName' => 'dowódca' ]); - DB::table('trainings')->insert([ 'id' => '3', 'fireStationID' => '0', 'trainingName' => 'kierowca-mechanik' ]); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('trainings', function (Blueprint $table) { - // - }); - } -} \ No newline at end of file diff --git a/database/migrations/a/2020_07_19_203706_add_additional_data_about_firefighters.php b/database/migrations/a/2020_07_19_203706_add_additional_data_about_firefighters.php deleted file mode 100644 index bb8da60..0000000 --- a/database/migrations/a/2020_07_19_203706_add_additional_data_about_firefighters.php +++ /dev/null @@ -1,47 +0,0 @@ -string('secondName', 45)->nullable()->default(null); - $table->string('fathersName', 45)->nullable()->default(null); - $table->string('mothersName', 45)->nullable()->default(null); - $table->string('address', 45)->nullable()->default(null); - $table->string('apartment', 45)->nullable()->default(null); //nr domu - $table->string('placeOfBirth', 45)->nullable()->default(null); - $table->string('driversLicense', 20)->nullable()->default(null); - $table->date('joiningOSPDate', 20)->nullable()->default(null); - $table->string('IDSeries', 3)->nullable()->default(null); - $table->string('IDNumber', 6)->nullable()->default(null); //nr dowodu osobistego - $table->date('IDValidUntil', 20)->nullable()->default(null); - $table->string('identityCardNumber', 20)->nullable()->default(null); //nr legitymacji strażackiej - $table->string('homePhoneNumber', 20)->nullable()->default(null); - $table->string('education', 45)->nullable()->default(null); - $table->string('profession', 45)->nullable()->default(null); - - - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - // - } -}