123456789101112131415161718192021222324252627 |
- <?php
- use yii\db\Migration;
- class m240625_222117_nivel_municipio extends Migration {
- public function safeUp() {
- $this->createTable('NivelMunicipio', [
- "id" => $this->string(36),
- "idMunicipio" => $this->string(36),
- "idNivel" => $this->string(36),
- "creado" => $this->timestamp()->append('with time zone'),
- "modificado" => $this->timestamp()->append('with time zone'),
- "eliminado" => $this->timestamp()->append('with time zone'),
- ]);
- $this->addPrimaryKey('NivelMunicipioPK', 'NivelMunicipio', 'id');
- $this->addForeignKey('NivelMunicipioMunicipioFK', 'NivelMunicipio', 'idMunicipio', 'Municipio', 'id');
- $this->addForeignKey('NivelMunicipioNivelFK', 'NivelMunicipio', 'idNivel', 'Nivel', 'id');
- }
- public function safeDown() {
- $this->dropForeignKey('NivelMunicipioNivelFK', 'NivelMunicipio');
- $this->dropForeignKey('NivelMunicipioMunicipioFK', 'NivelMunicipio');
- $this->dropPrimaryKey('NivelMunicipioPK', 'NivelMunicipio');
- $this->dropTable('NivelMunicipio');
- }
- }
|