falta el update carrito del backend

This commit is contained in:
2025-10-29 13:31:25 +01:00
parent c272fd7b9b
commit 5e9631073e
17 changed files with 516 additions and 162 deletions

View File

@ -0,0 +1,28 @@
databaseChangeLog:
- changeSet:
id: 0005-add-carts-onlyoneshipment
author: jjo
preConditions:
onFail: MARK_RAN
not:
columnExists:
tableName: carts
columnName: only_one_shipment
changes:
- addColumn:
tableName: carts
columns:
- column:
name: only_one_shipment
type: TINYINT(1)
defaultValueNumeric: 1
remarks: "Si 1, el carrito tiene la misma direccion para todos los items"
afterColumn: currency
constraints:
nullable: false
rollback:
- dropColumn:
tableName: carts
columnName: only_one_shipment

View File

@ -0,0 +1,81 @@
databaseChangeLog:
- changeSet:
id: 0006-add-cart-direcciones
author: jjo
preConditions:
onFail: MARK_RAN
not:
tableExists:
tableName: cart_direcciones
changes:
- createTable:
tableName: cart_direcciones
remarks: "Relación de direcciones y unidades por carrito/direcciones_envio"
columns:
- column:
name: id
type: BIGINT UNSIGNED AUTO_INCREMENT
constraints:
primaryKey: true
primaryKeyName: pk_cart_direcciones
- column:
name: direccion_id
type: BIGINT
constraints:
nullable: false
- column:
name: presupuesto_id
type: BIGINT
constraints:
nullable: true
- column:
name: unidades
type: INT
constraints:
nullable: true
- createIndex:
indexName: idx_cart_dir_direccion_id
tableName: cart_direcciones
columns:
- column:
name: direccion_id
- createIndex:
indexName: idx_cart_dir_presupuesto_id
tableName: cart_direcciones
columns:
- column:
name: presupuesto_id
- addForeignKeyConstraint:
baseTableName: cart_direcciones
baseColumnNames: direccion_id
constraintName: fk_cart_dir_direccion
referencedTableName: direcciones
referencedColumnNames: id
onDelete: CASCADE
onUpdate: CASCADE
- addForeignKeyConstraint:
baseTableName: cart_direcciones
baseColumnNames: presupuesto_id
constraintName: fk_cart_dir_presupuesto
referencedTableName: presupuesto
referencedColumnNames: id
onDelete: SET NULL
onUpdate: CASCADE
rollback:
- dropForeignKeyConstraint:
baseTableName: cart_direcciones
constraintName: fk_cart_dir_direccion
- dropForeignKeyConstraint:
baseTableName: cart_direcciones
constraintName: fk_cart_dir_presupuesto
- dropTable:
tableName: cart_direcciones

View File

@ -6,4 +6,8 @@ databaseChangeLog:
- include:
file: db/changelog/changesets/0003-create-paises.yml
- include:
file: db/changelog/changesets/0004-create-direcciones.yml
file: db/changelog/changesets/0004-create-direcciones.yml
- include:
file: db/changelog/changesets/0005-add-carts-onlyoneshipment.yml
- include:
file: db/changelog/changesets/0006-add-cart-direcciones.yml