1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- use yii\db\Migration;
- /**
- * Class m241016_185927_Tabla_Gasto_y_Pagos_creacion
- */
- class m241016_185927_Tabla_Gasto_y_Pagos_creacion extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $this->createTable('Gasto', [
- "id" => $this->string(36),
- "idObra" => $this->string(36),
- "idConceptoObra" => $this->string(36),
- "cantidad" => $this->integer(),
- "descripcion" => $this->string(100),
- "fechaCompra" => $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->addForeignKey("GastoObraFK", "Gasto", "idObra", "Obra", "id");
- $this->addForeignKey("GastoConceptoFK", "Gasto", "idConceptoObra", "ConceptoObra", "id");
- $this->addPrimaryKey('GastoPK', 'Gasto', 'id');
- $this->createTable('Pago', [
- "id" => $this->string(36),
- "idObra" => $this->string(36),
- "idConceptoObra" => $this->string(36),
- "cantidad" => $this->integer(),
- "descripcion" => $this->string(100),
- "fechaPago" => $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->addForeignKey("PagoObraFK", "Pago", "idObra", "Obra", "id");
- $this->addForeignKey("PagoConceptoFK", "Pago", "idConceptoObra", "ConceptoObra", "id");
- $this->addPrimaryKey('PagoPK', 'Pago', 'id');
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropForeignKey("GastoObra", "Gasto");
- $this->dropForeignKey("GastoConcepto", "Gasto");
- $this->dropTable('Gasto');
- $this->dropForeignKey("PagoObra", "Pago");
- $this->dropForeignKey("PagoConcepto", "Pago");
- $this->dropTable('Pago');
- }
-
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "m241016_185927_Tabla_Gasto_y_Pagos_creacion cannot be reverted.\n";
- return false;
- }
- */
- }
|