| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- use yii\db\Migration;
- /**
- * Class m230130_184544_tabla_grupos_eventos
- */
- class m230130_184544_tabla_grupos_eventos extends Migration {
- /**
- * {@inheritdoc}
- */
- public function safeUp() {
- $this->createTable("EventoGrupo", [
- "idEvento" => $this->integer(),
- "idGrupo" => $this->integer(),
- ]);
- $this->addPrimaryKey('EventoGrupoPK', 'EventoGrupo', ['idEvento', 'idGrupo']);
- $this->alterColumn("Evento", "nombre", $this->string(255)->notNull());
- $this->alterColumn("Evento", "descripcion", $this->text());
- $this->dropColumn("Evento", "idGrupo");
- $this->addForeignKey('EventoGrupoIdEventoFK', 'EventoGrupo', 'idEvento', 'Evento', 'id');
- $this->addForeignKey('EventoGrupoIdGrupoFK', 'EventoGrupo', 'idGrupo', 'Grupo', 'id');
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown() {
- $this->dropForeignKey("EventoGrupoIdGrupoFK", "EventoGrupo");
- $this->dropForeignKey("EventoGrupoIdEventoFK", "EventoGrupo");
-
- $this->addColumn("Evento", "idGrupo", $this->integer());
- $this->alterColumn("Evento", "descripcion", $this->string(255));
- $this->alterColumn("Evento", "nombre", $this->string(100)->notNull());
- $this->dropPrimaryKey("EventoGrupoPK", "EventoGrupo");
- $this->dropTable('EventoGrupo');
- }
- }
|