146 lines
3.4 KiB
PHP
146 lines
3.4 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
class JednostkiTerytorialne extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('wojewodztwa', function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->string('name');
|
|
});
|
|
|
|
Schema::create('powiaty', function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->integer('wojewodztwo_id');
|
|
$table->string('name');
|
|
});
|
|
|
|
Schema::create('gminy', function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->integer('wojewodztwo_id');
|
|
$table->integer('powiat_id');
|
|
$table->string('name');
|
|
});
|
|
|
|
|
|
// dane testowe
|
|
DB::table('wojewodztwa')->insert(
|
|
array(
|
|
'name' => 'wielkopolskie'
|
|
)
|
|
);
|
|
DB::table('wojewodztwa')->insert(
|
|
array(
|
|
'name' => 'pomorskie'
|
|
)
|
|
);
|
|
|
|
|
|
|
|
DB::table('powiaty')->insert(
|
|
array(
|
|
'wojewodztwo_id' => '1',
|
|
'name' => 'poznański'
|
|
)
|
|
);
|
|
DB::table('powiaty')->insert(
|
|
array(
|
|
'wojewodztwo_id' => '1',
|
|
'name' => 'koniński'
|
|
)
|
|
);
|
|
DB::table('powiaty')->insert(
|
|
array(
|
|
'wojewodztwo_id' => '2',
|
|
'name' => 'kartuski'
|
|
)
|
|
);
|
|
DB::table('powiaty')->insert(
|
|
array(
|
|
'wojewodztwo_id' => '2',
|
|
'name' => 'kwidzyński'
|
|
)
|
|
);
|
|
|
|
|
|
|
|
DB::table('gminy')->insert(
|
|
array(
|
|
'wojewodztwo_id' => '1',
|
|
'powiat_id' => '1',
|
|
'name' => 'Dopiewo'
|
|
)
|
|
);
|
|
DB::table('gminy')->insert(
|
|
array(
|
|
'wojewodztwo_id' => '1',
|
|
'powiat_id' => '1',
|
|
'name' => 'Suchy Las'
|
|
)
|
|
);
|
|
DB::table('gminy')->insert(
|
|
array(
|
|
'wojewodztwo_id' => '1',
|
|
'powiat_id' => '2',
|
|
'name' => 'Skulsk'
|
|
)
|
|
);
|
|
DB::table('gminy')->insert(
|
|
array(
|
|
'wojewodztwo_id' => '1',
|
|
'powiat_id' => '2',
|
|
'name' => 'Wilczyn'
|
|
)
|
|
);
|
|
DB::table('gminy')->insert(
|
|
array(
|
|
'wojewodztwo_id' => '2',
|
|
'powiat_id' => '3',
|
|
'name' => 'Sierakowice'
|
|
)
|
|
);
|
|
DB::table('gminy')->insert(
|
|
array(
|
|
'wojewodztwo_id' => '2',
|
|
'powiat_id' => '3',
|
|
'name' => 'Chmielno'
|
|
)
|
|
);
|
|
DB::table('gminy')->insert(
|
|
array(
|
|
'wojewodztwo_id' => '2',
|
|
'powiat_id' => '4',
|
|
'name' => 'Gardeja'
|
|
)
|
|
);
|
|
DB::table('gminy')->insert(
|
|
array(
|
|
'wojewodztwo_id' => '2',
|
|
'powiat_id' => '4',
|
|
'name' => 'Sadlinki'
|
|
)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('wojewodztwa');
|
|
Schema::dropIfExists('powiaty');
|
|
Schema::dropIfExists('gminy');
|
|
}
|
|
}
|