m230130_184544_tabla_grupos_eventos.php 945 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. use yii\db\Migration;
  3. /**
  4. * Class m230130_184544_tabla_grupos_eventos
  5. */
  6. class m230130_184544_tabla_grupos_eventos extends Migration {
  7. /**
  8. * {@inheritdoc}
  9. */
  10. public function safeUp() {
  11. $this->createTable("EventoGrupo", [
  12. "idEvento" => $this->integer(),
  13. "idGrupo" => $this->integer(),
  14. ]);
  15. $this->addPrimaryKey('EventoGrupoPK', 'EventoGrupo', ['idEvento', 'idGrupo']);
  16. $this->alterColumn("Evento", "nombre", $this->string(255)->notNull());
  17. $this->alterColumn("Evento", "descripcion", $this->text());
  18. $this->dropColumn("Evento", "idGrupo");
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function safeDown() {
  24. $this->addColumn("Evento", "idGrupo", $this->integer());
  25. $this->alterColumn("Evento", "descripcion", $this->string(255));
  26. $this->alterColumn("Evento", "nombre", $this->string(100)->notNull());
  27. $this->dropPrimaryKey("EventoGrupoPK", "EventoGrupo");
  28. $this->dropTable('EventoGrupo');
  29. }
  30. }