/** * Defines the table at the specified version * * @param Table $table Table * @param string $version Version */ public function define(Table $table, $version) { parent::defineLocality('State', $table, $version); switch (true) { // Version 0.1.0 case version_compare($version, "0.1.0", '>='): // Unique Keys $table->addUniqueIndex(['country_id', 'name_utf8'], 'UK_GeoState_nameUtf8'); $table->addUniqueIndex(['country_id', 'name_ascii'], 'UK_GeoState_nameAscii'); } }
/** * Defines the table at the specified version * * @param Table $table Table * @param string $version Version */ public function define(Table $table, $version) { parent::defineLocality('City', $table, $version); switch (true) { // Version 0.1.0 case version_compare($version, "0.1.0", '>='): $table->addColumn('state_id', 'integer')->setUnsigned(true)->setNotNull(false)->setComment('State (=> ' . StateTableDefinition::NAME . '.id'); // Foriegn keys $table->addNamedForeignKeyConstraint('FK_GeoCity_state', CountryTableDefinition::NAME, ['state_id'], ['id']); } }