|
@@ -0,0 +1,77 @@
|
|
|
|
+<?php
|
|
|
|
+
|
|
|
|
+use yii\db\Migration;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Class m241015_212707_Tabla_Gastos_y_Pagos_creacion
|
|
|
|
+ */
|
|
|
|
+class m241015_212707_Tabla_Gastos_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->string(100),
|
|
|
|
+ "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->string(100),
|
|
|
|
+ "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 "m241015_212707_Tabla_Gastos_y_Pagos_creacion cannot be reverted.\n";
|
|
|
|
+
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ */
|
|
|
|
+}
|