createTable('bus_stop', [ 'bus_stop_id' => $this->primaryKey() ->comment('Індекс'), 'road_id' => $this->integer() ->comment('Дорога'), 'region_id' => $this->integer() ->comment('Область'), 'settlement_id' => $this->integer() ->comment('Назва населеного пункту'), 'location_right' => $this->float() ->comment('Місцезнаходження, км+ справа'), 'location_left' => $this->float() ->comment('Місцезнаходження, км+ зліва'), 'surface_type_id' => $this->integer() ->comment('Тип покриття'), 'area_stop_availability' => $this->integer() ->comment('Наявність елементів зупин. майдан'), 'area_land_availability' => $this->integer() ->comment('Наявність елементів посад. майдан'), 'pocket_availability' => $this->integer() ->comment('Наявність елементів заїзна кишеня'), 'toilet_availability' => $this->integer() ->comment('Наявність елементів туалет'), 'year_build' => $this->integer() ->comment('Рік будівництва'), 'year_repair' => $this->integer() ->comment('Рік ремонту'), 'state_common_id' => $this->integer() ->comment('Технічний стан'), ]); $this->addForeignKey('bus_stop_road', 'bus_stop', 'road_id', 'road', 'road_id', 'CASCADE', 'CASCADE'); $this->addForeignKey('bus_stop_region', 'bus_stop', 'region_id', 'region', 'region_id', 'CASCADE', 'CASCADE'); $this->addForeignKey('bus_stop_settlement', 'bus_stop', 'settlement_id', 'settlement', 'settlement_id', 'CASCADE', 'CASCADE'); $this->addForeignKey('bus_stop_surface_type', 'bus_stop', 'surface_type_id', 'surface_type', 'surface_type_id', 'CASCADE', 'CASCADE'); $this->addForeignKey('bus_stop_state_common', 'bus_stop', 'state_common_id', 'state_common', 'state_common_id', 'CASCADE', 'CASCADE'); } /** * @inheritdoc */ public function down() { $this->dropForeignKey('bus_stop_road', 'bus_stop'); $this->dropForeignKey('bus_stop_region', 'bus_stop'); $this->dropForeignKey('bus_stop_settlement', 'bus_stop'); $this->dropForeignKey('bus_stop_surface_type', 'bus_stop'); $this->dropForeignKey('bus_stop_state_common', 'bus_stop'); $this->dropTable('bus_stop'); } }