Przeglądaj źródła

Se corrigio migracion

Jose Cienfuegos 9 miesięcy temu
rodzic
commit
03898ad7ba

+ 12 - 4
migrations/m240722_185718_tabla_tipoServicio_y_cambio_a_numero_en_costo.php

@@ -12,6 +12,7 @@ class m240722_185718_tabla_tipoServicio_y_cambio_a_numero_en_costo extends Migra
      */
     public function safeUp()
     {
+        // Crear la tabla TipoServicio
         $this->createTable('TipoServicio', [
             "id" => $this->string(36),
             "clave" => $this->string(100)->notNull(),
@@ -23,16 +24,23 @@ class m240722_185718_tabla_tipoServicio_y_cambio_a_numero_en_costo extends Migra
 
         $this->addPrimaryKey('TipoServicioPK', 'TipoServicio', 'id');
 
-        $this->execute('ALTER TABLE "ServicioElemento" ALTER COLUMN "costo" TYPE decimal(10,2) USING "costo"::decimal(10,2)');
+        $this->dropColumn('ServicioElemento', 'costo');
+
+        $this->addColumn('ServicioElemento', 'costo', $this->decimal(10,2)->notNull()->defaultValue(0));
     }
-    
+
     /**
      * {@inheritdoc}
      */
     public function safeDown()
     {
-        $this->alterColumn('ServicioElemento', 'costo', $this->string());
-    
+
+        $this->dropColumn('ServicioElemento', 'costo');
+
+  
+        $this->addColumn('ServicioElemento', 'costo', $this->string());
+
+
         $this->dropTable('TipoServicio');
     }
 }