m240625_174436_tabla_nivel.php 961 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. use yii\db\Migration;
  3. /**
  4. * Class m240625_174436_tabla_nivel
  5. */
  6. class m240625_174436_tabla_nivel extends Migration
  7. {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function safeUp()
  12. {
  13. $this->createTable("Nivel", [
  14. "id" => $this->string(36),
  15. "nombre" => $this->string(100),
  16. "idMunicipio" => $this->string(36),
  17. "clave" => $this->string(100),
  18. "creado" => $this->timestamp(),
  19. "modificado" => $this->timestamp(),
  20. "eliminado" => $this->timestamp(),
  21. ]);
  22. $this->addPrimaryKey("NivelPK", "Nivel", "id");
  23. $this->addForeignKey("NivelMunicipioIdFK", "Nivel", "idMunicipio", "Municipio", "id");
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function safeDown()
  29. {
  30. $this->dropForeignKey("NivelMunicipioIdFK", "Nivel");
  31. $this->dropPrimaryKey("NivelPK", "Nivel");
  32. $this->dropTable("Nivel");
  33. }
  34. }