ソースを参照

Se cambio tipo de integer a numeric la columna cantidad en tabla gasto

Jose Cienfuegos 6 ヶ月 前
コミット
02267d8b17
共有2 個のファイルを変更した20 個の追加1 個の削除を含む
  1. 19 0
      migrations/m241026_021858_cambio_columna_cantida_gastos.php
  2. 1 1
      models/Gasto.php

+ 19 - 0
migrations/m241026_021858_cambio_columna_cantida_gastos.php

@@ -0,0 +1,19 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m241026_021858_cambio_columna_cantida_gastos
+ */
+class m241026_021858_cambio_columna_cantida_gastos extends Migration
+{
+    public function safeUp()
+    {
+        $this->alterColumn('Gasto', 'cantidad', $this->decimal(10,2));
+    }
+
+    public function safeDown()
+    {
+        $this->alterColumn('Gasto', 'cantidad', $this->integer());
+    }
+}

+ 1 - 1
models/Gasto.php

@@ -34,7 +34,7 @@ class Gasto extends ModeloBase
         return [
             [['id','idObra','idConceptoObra'], 'required'],
             [['creado', 'modificado', 'eliminado','fechaCompra'], 'safe'],
-            [['cantidad'], 'integer'],
+            [['cantidad'], 'numeric'],
             [['cantidad'], 'default', 'value' => null],
             [['id', 'idObra','idConceptoObra'], 'string', 'max' => 36],
             [[ 'descripcion'], 'string', 'max' => 100],