12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- use yii\db\Migration;
- /**
- * Class m241122_235440_tablas_campanas_banner
- */
- class m241122_235440_tablas_campanas_banner extends Migration
- { public function safeUp()
- {
- $this->createTable('Campana', [
- "id" => $this->string(36),
- "idMedia" => $this->string(36),
- "nombre" => $this->string(),
- "descripcion" => $this->string(550),
- "activo" => $this->boolean()->defaultValue(false),
- "fechaInicio" => $this->timestamp()->append(" with time zone"),
- "fechaFin" => $this->timestamp()->append(" with time zone"),
- "creado" => $this->timestamp()->append(" with time zone"),
- "modificado" => $this->timestamp()->append(" with time zone"),
- "eliminado" => $this->timestamp()->append(" with time zone"),
- ]);
- $this->addPrimaryKey('CampanaPK', 'Campana', 'id');
- $this->addForeignKey('CampanaMediaFK', 'Campana', 'idMedia', 'Media', 'id');
- $this->createTable('Banner', [
- "id" => $this->string(36),
- "idCampana" => $this->string(36),
- "idMedia" => $this->string(36),
- "nombre" => $this->string(),
- "tamano" => $this->string(),
- "descripcion" => $this->text(),
- "activo" => $this->boolean()->defaultValue(false),
- "fechaInicio" => $this->timestamp()->append("with time zone"),
- "fechaFin" => $this->timestamp()->append("with time zone"),
- "creado" => $this->timestamp()->append("with time zone"),
- "modificado" => $this->timestamp()->append("with time zone"),
- "eliminado" => $this->timestamp()->append("with time zone")
- ]);
- $this->addPrimaryKey('BannerPK', 'Banner', 'id');
- $this->addForeignKey('BannerCampanaFK', 'Banner', 'idCampana', 'Campana', 'id');
- }
- public function safeDown()
- {
- $this->dropForeignKey('BannerCampanaFK', 'Banner');
- $this->dropForeignKey('CampanaMediaFK', 'Campana');
- $this->dropTable('Banner');
- $this->dropTable('Campana');
- }
- }
|