瀏覽代碼

Se corrigio migracion

Jose Cienfuegos 9 月之前
父節點
當前提交
03898ad7ba
共有 1 個文件被更改,包括 12 次插入4 次删除
  1. 12 4
      migrations/m240722_185718_tabla_tipoServicio_y_cambio_a_numero_en_costo.php

+ 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');
     }
 }