mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-19 23:30:20 +00:00
testeando el notify
This commit is contained in:
@ -7,53 +7,172 @@ databaseChangeLog:
|
||||
- createTable:
|
||||
tableName: payment_methods
|
||||
columns:
|
||||
- column: { name: id, type: BIGINT AUTO_INCREMENT, constraints: { primaryKey: true, nullable: false } }
|
||||
- column: { name: user_id, type: BIGINT }
|
||||
- column: { name: type, type: ENUM('card','bizum','bank_transfer'), constraints: { nullable: false } }
|
||||
- column: { name: brand, type: VARCHAR(32) }
|
||||
- column: { name: last4, type: VARCHAR(4) }
|
||||
- column: { name: exp_month, type: TINYINT }
|
||||
- column: { name: exp_year, type: SMALLINT }
|
||||
- column: { name: fingerprint, type: VARCHAR(128) }
|
||||
- column: { name: token_id, type: VARCHAR(128) } # alias/token de pasarela (nunca PAN)
|
||||
- column: { name: sepa_mandate_id, type: VARCHAR(128) }
|
||||
- column: { name: payer_email, type: VARCHAR(190) }
|
||||
- column: { name: metadata, type: JSON }
|
||||
- column: { name: created_at, type: DATETIME, defaultValueComputed: CURRENT_TIMESTAMP, constraints: { nullable: false } }
|
||||
- column: { name: updated_at, type: DATETIME, defaultValueComputed: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, constraints: { nullable: false } }
|
||||
- column:
|
||||
name: id
|
||||
type: BIGINT AUTO_INCREMENT
|
||||
constraints:
|
||||
primaryKey: true
|
||||
nullable: false
|
||||
- column:
|
||||
name: user_id
|
||||
type: BIGINT
|
||||
- column:
|
||||
name: type
|
||||
type: "ENUM('card','bizum','bank_transfer')"
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: brand
|
||||
type: VARCHAR(32)
|
||||
- column:
|
||||
name: last4
|
||||
type: VARCHAR(4)
|
||||
- column:
|
||||
name: exp_month
|
||||
type: TINYINT
|
||||
- column:
|
||||
name: exp_year
|
||||
type: SMALLINT
|
||||
- column:
|
||||
name: fingerprint
|
||||
type: VARCHAR(128)
|
||||
- column:
|
||||
name: token_id
|
||||
type: VARCHAR(128)
|
||||
- column:
|
||||
name: sepa_mandate_id
|
||||
type: VARCHAR(128)
|
||||
- column:
|
||||
name: payer_email
|
||||
type: VARCHAR(190)
|
||||
- column:
|
||||
name: metadata
|
||||
type: JSON
|
||||
- column:
|
||||
name: created_at
|
||||
type: DATETIME
|
||||
defaultValueComputed: CURRENT_TIMESTAMP
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: updated_at
|
||||
type: DATETIME
|
||||
defaultValueComputed: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
|
||||
constraints:
|
||||
nullable: false
|
||||
|
||||
- addUniqueConstraint:
|
||||
tableName: payment_methods
|
||||
columnNames: token_id
|
||||
constraintName: uq_payment_methods_token
|
||||
|
||||
# 2) payments (una intención de cobro por pedido)
|
||||
# 2) payments
|
||||
- createTable:
|
||||
tableName: payments
|
||||
columns:
|
||||
- column: { name: id, type: BIGINT AUTO_INCREMENT, constraints: { primaryKey: true, nullable: false } }
|
||||
- column: { name: order_id, type: BIGINT, constraints: { nullable: false } } # tu pedido interno
|
||||
- column: { name: user_id, type: BIGINT }
|
||||
- column: { name: payment_method_id, type: BIGINT }
|
||||
- column: { name: currency, type: CHAR(3), constraints: { nullable: false } }
|
||||
- column: { name: amount_total_cents, type: BIGINT, constraints: { nullable: false } }
|
||||
- column: { name: amount_captured_cents, type: BIGINT, defaultValueNumeric: 0, constraints: { nullable: false } }
|
||||
- column: { name: amount_refunded_cents, type: BIGINT, defaultValueNumeric: 0, constraints: { nullable: false } }
|
||||
- column: { name: status, type: ENUM('requires_payment_method','requires_action','authorized','captured','partially_refunded','refunded','canceled','failed'), defaultValue: requires_payment_method, constraints: { nullable: false } }
|
||||
- column: { name: capture_method, type: ENUM('automatic','manual'), defaultValue: automatic, constraints: { nullable: false } }
|
||||
- column: { name: gateway, type: VARCHAR(32), constraints: { nullable: false } } # 'redsys'
|
||||
- column: { name: gateway_payment_id, type: VARCHAR(128) } # id en pasarela
|
||||
- column: { name: gateway_order_id, type: VARCHAR(12) } # Ds_Order
|
||||
- column: { name: authorization_code, type: VARCHAR(32) }
|
||||
- column: { name: three_ds_status, type: ENUM('not_applicable','attempted','challenge','succeeded','failed'), defaultValue: not_applicable, constraints: { nullable: false } }
|
||||
- column: { name: descriptor, type: VARCHAR(22) }
|
||||
- column: { name: client_ip, type: VARBINARY(16) }
|
||||
- column: { name: authorized_at, type: DATETIME }
|
||||
- column: { name: captured_at, type: DATETIME }
|
||||
- column: { name: canceled_at, type: DATETIME }
|
||||
- column: { name: failed_at, type: DATETIME }
|
||||
- column: { name: metadata, type: JSON }
|
||||
- column: { name: created_at, type: DATETIME, defaultValueComputed: CURRENT_TIMESTAMP, constraints: { nullable: false } }
|
||||
- column: { name: updated_at, type: DATETIME, defaultValueComputed: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, constraints: { nullable: false } }
|
||||
- column:
|
||||
name: id
|
||||
type: BIGINT AUTO_INCREMENT
|
||||
constraints:
|
||||
primaryKey: true
|
||||
nullable: false
|
||||
- column:
|
||||
name: order_id
|
||||
type: BIGINT
|
||||
- column:
|
||||
name: user_id
|
||||
type: BIGINT
|
||||
- column:
|
||||
name: payment_method_id
|
||||
type: BIGINT
|
||||
- column:
|
||||
name: currency
|
||||
type: CHAR(3)
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: amount_total_cents
|
||||
type: BIGINT
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: amount_captured_cents
|
||||
type: BIGINT
|
||||
defaultValueNumeric: 0
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: amount_refunded_cents
|
||||
type: BIGINT
|
||||
defaultValueNumeric: 0
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: status
|
||||
type: "ENUM('requires_payment_method','requires_action','authorized','captured','partially_refunded','refunded','canceled','failed')"
|
||||
defaultValue: "requires_payment_method"
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: capture_method
|
||||
type: "ENUM('automatic','manual')"
|
||||
defaultValue: "automatic"
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: gateway
|
||||
type: VARCHAR(32)
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: gateway_payment_id
|
||||
type: VARCHAR(128)
|
||||
- column:
|
||||
name: gateway_order_id
|
||||
type: VARCHAR(12)
|
||||
- column:
|
||||
name: authorization_code
|
||||
type: VARCHAR(32)
|
||||
- column:
|
||||
name: three_ds_status
|
||||
type: "ENUM('not_applicable','attempted','challenge','succeeded','failed')"
|
||||
defaultValue: "not_applicable"
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: descriptor
|
||||
type: VARCHAR(22)
|
||||
- column:
|
||||
name: client_ip
|
||||
type: VARBINARY(16)
|
||||
- column:
|
||||
name: authorized_at
|
||||
type: DATETIME
|
||||
- column:
|
||||
name: captured_at
|
||||
type: DATETIME
|
||||
- column:
|
||||
name: canceled_at
|
||||
type: DATETIME
|
||||
- column:
|
||||
name: failed_at
|
||||
type: DATETIME
|
||||
- column:
|
||||
name: metadata
|
||||
type: JSON
|
||||
- column:
|
||||
name: created_at
|
||||
type: DATETIME
|
||||
defaultValueComputed: CURRENT_TIMESTAMP
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: updated_at
|
||||
type: DATETIME
|
||||
defaultValueComputed: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
|
||||
constraints:
|
||||
nullable: false
|
||||
|
||||
- addForeignKeyConstraint:
|
||||
baseTableName: payments
|
||||
baseColumnNames: payment_method_id
|
||||
@ -61,34 +180,104 @@ databaseChangeLog:
|
||||
referencedColumnNames: id
|
||||
constraintName: fk_payments_payment_methods
|
||||
onDelete: SET NULL
|
||||
- createIndex: { tableName: payments, indexName: idx_payments_order, columns: [ {name: order_id} ] }
|
||||
- createIndex: { tableName: payments, indexName: idx_payments_gateway, columns: [ {name: gateway}, {name: gateway_payment_id} ] }
|
||||
- createIndex: { tableName: payments, indexName: idx_payments_status, columns: [ {name: status} ] }
|
||||
|
||||
- createIndex:
|
||||
tableName: payments
|
||||
indexName: idx_payments_order
|
||||
columns:
|
||||
- column:
|
||||
name: order_id
|
||||
|
||||
- createIndex:
|
||||
tableName: payments
|
||||
indexName: idx_payments_gateway
|
||||
columns:
|
||||
- column:
|
||||
name: gateway
|
||||
- column:
|
||||
name: gateway_payment_id
|
||||
|
||||
- createIndex:
|
||||
tableName: payments
|
||||
indexName: idx_payments_status
|
||||
columns:
|
||||
- column:
|
||||
name: status
|
||||
|
||||
- addUniqueConstraint:
|
||||
tableName: payments
|
||||
columnNames: gateway, gateway_order_id
|
||||
constraintName: uq_payments_gateway_order
|
||||
|
||||
# 3) payment_transactions (libro mayor: AUTH/CAPTURE/REFUND/VOID)
|
||||
# 3) payment_transactions
|
||||
- createTable:
|
||||
tableName: payment_transactions
|
||||
columns:
|
||||
- column: { name: id, type: BIGINT AUTO_INCREMENT, constraints: { primaryKey: true, nullable: false } }
|
||||
- column: { name: payment_id, type: BIGINT, constraints: { nullable: false } }
|
||||
- column: { name: type, type: ENUM('AUTH','CAPTURE','REFUND','VOID'), constraints: { nullable: false } }
|
||||
- column: { name: status, type: ENUM('pending','succeeded','failed'), constraints: { nullable: false } }
|
||||
- column: { name: amount_cents, type: BIGINT, constraints: { nullable: false } }
|
||||
- column: { name: currency, type: CHAR(3), constraints: { nullable: false } }
|
||||
- column: { name: gateway_transaction_id, type: VARCHAR(128) }
|
||||
- column: { name: gateway_response_code, type: VARCHAR(64) }
|
||||
- column: { name: avs_result, type: VARCHAR(8) }
|
||||
- column: { name: cvv_result, type: VARCHAR(8) }
|
||||
- column: { name: three_ds_version, type: VARCHAR(16) }
|
||||
- column: { name: idempotency_key, type: VARCHAR(128) }
|
||||
- column: { name: request_payload, type: JSON }
|
||||
- column: { name: response_payload, type: JSON }
|
||||
- column: { name: processed_at, type: DATETIME }
|
||||
- column: { name: created_at, type: DATETIME, defaultValueComputed: CURRENT_TIMESTAMP, constraints: { nullable: false } }
|
||||
- column:
|
||||
name: id
|
||||
type: BIGINT AUTO_INCREMENT
|
||||
constraints:
|
||||
primaryKey: true
|
||||
nullable: false
|
||||
- column:
|
||||
name: payment_id
|
||||
type: BIGINT
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: type
|
||||
type: "ENUM('AUTH','CAPTURE','REFUND','VOID')"
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: status
|
||||
type: "ENUM('pending','succeeded','failed')"
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: amount_cents
|
||||
type: BIGINT
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: currency
|
||||
type: CHAR(3)
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: gateway_transaction_id
|
||||
type: VARCHAR(128)
|
||||
- column:
|
||||
name: gateway_response_code
|
||||
type: VARCHAR(64)
|
||||
- column:
|
||||
name: avs_result
|
||||
type: VARCHAR(8)
|
||||
- column:
|
||||
name: cvv_result
|
||||
type: VARCHAR(8)
|
||||
- column:
|
||||
name: three_ds_version
|
||||
type: VARCHAR(16)
|
||||
- column:
|
||||
name: idempotency_key
|
||||
type: VARCHAR(128)
|
||||
- column:
|
||||
name: request_payload
|
||||
type: JSON
|
||||
- column:
|
||||
name: response_payload
|
||||
type: JSON
|
||||
- column:
|
||||
name: processed_at
|
||||
type: DATETIME
|
||||
- column:
|
||||
name: created_at
|
||||
type: DATETIME
|
||||
defaultValueComputed: CURRENT_TIMESTAMP
|
||||
constraints:
|
||||
nullable: false
|
||||
|
||||
- addForeignKeyConstraint:
|
||||
baseTableName: payment_transactions
|
||||
baseColumnNames: payment_id
|
||||
@ -96,30 +285,92 @@ databaseChangeLog:
|
||||
referencedColumnNames: id
|
||||
constraintName: fk_tx_payment
|
||||
onDelete: CASCADE
|
||||
|
||||
- addUniqueConstraint:
|
||||
tableName: payment_transactions
|
||||
columnNames: gateway_transaction_id
|
||||
constraintName: uq_tx_gateway_txid
|
||||
- createIndex: { tableName: payment_transactions, indexName: idx_tx_pay, columns: [ {name: payment_id} ] }
|
||||
- createIndex: { tableName: payment_transactions, indexName: idx_tx_type_status, columns: [ {name: type}, {name: status} ] }
|
||||
- createIndex: { tableName: payment_transactions, indexName: idx_tx_idem, columns: [ {name: idempotency_key} ] }
|
||||
|
||||
# 4) refunds (orquestador de devoluciones)
|
||||
- createIndex:
|
||||
tableName: payment_transactions
|
||||
indexName: idx_tx_pay
|
||||
columns:
|
||||
- column:
|
||||
name: payment_id
|
||||
|
||||
- createIndex:
|
||||
tableName: payment_transactions
|
||||
indexName: idx_tx_type_status
|
||||
columns:
|
||||
- column:
|
||||
name: type
|
||||
- column:
|
||||
name: status
|
||||
|
||||
- createIndex:
|
||||
tableName: payment_transactions
|
||||
indexName: idx_tx_idem
|
||||
columns:
|
||||
- column:
|
||||
name: idempotency_key
|
||||
|
||||
# 4) refunds
|
||||
- createTable:
|
||||
tableName: refunds
|
||||
columns:
|
||||
- column: { name: id, type: BIGINT AUTO_INCREMENT, constraints: { primaryKey: true, nullable: false } }
|
||||
- column: { name: payment_id, type: BIGINT, constraints: { nullable: false } }
|
||||
- column: { name: transaction_id, type: BIGINT } # REFUND en payment_transactions
|
||||
- column: { name: amount_cents, type: BIGINT, constraints: { nullable: false } }
|
||||
- column: { name: reason, type: ENUM('customer_request','partial_return','pricing_adjustment','duplicate','fraud','other'), defaultValue: customer_request, constraints: { nullable: false } }
|
||||
- column: { name: status, type: ENUM('pending','succeeded','failed','canceled'), defaultValue: pending, constraints: { nullable: false } }
|
||||
- column: { name: requested_by_user_id, type: BIGINT }
|
||||
- column: { name: requested_at, type: DATETIME, defaultValueComputed: CURRENT_TIMESTAMP, constraints: { nullable: false } }
|
||||
- column: { name: processed_at, type: DATETIME }
|
||||
- column: { name: gateway_refund_id, type: VARCHAR(128) }
|
||||
- column: { name: notes, type: VARCHAR(500) }
|
||||
- column: { name: metadata, type: JSON }
|
||||
- column:
|
||||
name: id
|
||||
type: BIGINT AUTO_INCREMENT
|
||||
constraints:
|
||||
primaryKey: true
|
||||
nullable: false
|
||||
- column:
|
||||
name: payment_id
|
||||
type: BIGINT
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: transaction_id
|
||||
type: BIGINT
|
||||
- column:
|
||||
name: amount_cents
|
||||
type: BIGINT
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: reason
|
||||
type: "ENUM('customer_request','partial_return','pricing_adjustment','duplicate','fraud','other')"
|
||||
defaultValue: "customer_request"
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: status
|
||||
type: "ENUM('pending','succeeded','failed','canceled')"
|
||||
defaultValue: "pending"
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: requested_by_user_id
|
||||
type: BIGINT
|
||||
- column:
|
||||
name: requested_at
|
||||
type: DATETIME
|
||||
defaultValueComputed: CURRENT_TIMESTAMP
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: processed_at
|
||||
type: DATETIME
|
||||
- column:
|
||||
name: gateway_refund_id
|
||||
type: VARCHAR(128)
|
||||
- column:
|
||||
name: notes
|
||||
type: VARCHAR(500)
|
||||
- column:
|
||||
name: metadata
|
||||
type: JSON
|
||||
|
||||
- addForeignKeyConstraint:
|
||||
baseTableName: refunds
|
||||
baseColumnNames: payment_id
|
||||
@ -127,6 +378,7 @@ databaseChangeLog:
|
||||
referencedColumnNames: id
|
||||
constraintName: fk_ref_payment
|
||||
onDelete: CASCADE
|
||||
|
||||
- addForeignKeyConstraint:
|
||||
baseTableName: refunds
|
||||
baseColumnNames: transaction_id
|
||||
@ -134,47 +386,138 @@ databaseChangeLog:
|
||||
referencedColumnNames: id
|
||||
constraintName: fk_ref_tx
|
||||
onDelete: SET NULL
|
||||
|
||||
- addUniqueConstraint:
|
||||
tableName: refunds
|
||||
columnNames: gateway_refund_id
|
||||
constraintName: uq_refund_gateway_id
|
||||
- createIndex: { tableName: refunds, indexName: idx_ref_pay, columns: [ {name: payment_id} ] }
|
||||
- createIndex: { tableName: refunds, indexName: idx_ref_status, columns: [ {name: status} ] }
|
||||
|
||||
# 5) webhooks (para Redsys: notificaciones asincrónicas)
|
||||
- createIndex:
|
||||
tableName: refunds
|
||||
indexName: idx_ref_pay
|
||||
columns:
|
||||
- column:
|
||||
name: payment_id
|
||||
|
||||
- createIndex:
|
||||
tableName: refunds
|
||||
indexName: idx_ref_status
|
||||
columns:
|
||||
- column:
|
||||
name: status
|
||||
|
||||
# 5) webhook_events
|
||||
- createTable:
|
||||
tableName: webhook_events
|
||||
columns:
|
||||
- column: { name: id, type: BIGINT AUTO_INCREMENT, constraints: { primaryKey: true, nullable: false } }
|
||||
- column: { name: provider, type: VARCHAR(32), constraints: { nullable: false } } # 'redsys'
|
||||
- column: { name: event_type, type: VARCHAR(64), constraints: { nullable: false } }
|
||||
- column: { name: event_id, type: VARCHAR(128) }
|
||||
- column: { name: signature, type: VARCHAR(512) }
|
||||
- column: { name: payload, type: JSON, constraints: { nullable: false } }
|
||||
- column: { name: processed, type: TINYINT(1), defaultValueNumeric: 0, constraints: { nullable: false } }
|
||||
- column: { name: processed_at, type: DATETIME }
|
||||
- column: { name: attempts, type: INT, defaultValueNumeric: 0, constraints: { nullable: false } }
|
||||
- column: { name: last_error, type: VARCHAR(500) }
|
||||
- column: { name: created_at, type: DATETIME, defaultValueComputed: CURRENT_TIMESTAMP, constraints: { nullable: false } }
|
||||
- column:
|
||||
name: id
|
||||
type: BIGINT AUTO_INCREMENT
|
||||
constraints:
|
||||
primaryKey: true
|
||||
nullable: false
|
||||
- column:
|
||||
name: provider
|
||||
type: VARCHAR(32)
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: event_type
|
||||
type: VARCHAR(64)
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: event_id
|
||||
type: VARCHAR(128)
|
||||
- column:
|
||||
name: signature
|
||||
type: VARCHAR(512)
|
||||
- column:
|
||||
name: payload
|
||||
type: JSON
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: processed
|
||||
type: TINYINT(1)
|
||||
defaultValueNumeric: 0
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: processed_at
|
||||
type: DATETIME
|
||||
- column:
|
||||
name: attempts
|
||||
type: INT
|
||||
defaultValueNumeric: 0
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: last_error
|
||||
type: VARCHAR(500)
|
||||
- column:
|
||||
name: created_at
|
||||
type: DATETIME
|
||||
defaultValueComputed: CURRENT_TIMESTAMP
|
||||
constraints:
|
||||
nullable: false
|
||||
|
||||
- addUniqueConstraint:
|
||||
tableName: webhook_events
|
||||
columnNames: provider, event_id
|
||||
constraintName: uq_webhook_provider_event
|
||||
- createIndex: { tableName: webhook_events, indexName: idx_webhook_processed, columns: [ {name: processed} ] }
|
||||
|
||||
# 6) idempotency_keys (evitar doble REFUND o reprocesos)
|
||||
- createIndex:
|
||||
tableName: webhook_events
|
||||
indexName: idx_webhook_processed
|
||||
columns:
|
||||
- column:
|
||||
name: processed
|
||||
|
||||
# 6) idempotency_keys
|
||||
- createTable:
|
||||
tableName: idempotency_keys
|
||||
columns:
|
||||
- column: { name: id, type: BIGINT AUTO_INCREMENT, constraints: { primaryKey: true, nullable: false } }
|
||||
- column: { name: scope, type: ENUM('payment','refund','webhook'), constraints: { nullable: false } }
|
||||
- column: { name: idem_key, type: VARCHAR(128), constraints: { nullable: false } }
|
||||
- column: { name: resource_id, type: BIGINT }
|
||||
- column: { name: response_cache, type: JSON }
|
||||
- column: { name: created_at, type: DATETIME, defaultValueComputed: CURRENT_TIMESTAMP, constraints: { nullable: false } }
|
||||
- column: { name: expires_at, type: DATETIME }
|
||||
- column:
|
||||
name: id
|
||||
type: BIGINT AUTO_INCREMENT
|
||||
constraints:
|
||||
primaryKey: true
|
||||
nullable: false
|
||||
- column:
|
||||
name: scope
|
||||
type: "ENUM('payment','refund','webhook')"
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: idem_key
|
||||
type: VARCHAR(128)
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: resource_id
|
||||
type: BIGINT
|
||||
- column:
|
||||
name: response_cache
|
||||
type: JSON
|
||||
- column:
|
||||
name: created_at
|
||||
type: DATETIME
|
||||
defaultValueComputed: CURRENT_TIMESTAMP
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: expires_at
|
||||
type: DATETIME
|
||||
|
||||
- addUniqueConstraint:
|
||||
tableName: idempotency_keys
|
||||
columnNames: scope, idem_key
|
||||
constraintName: uq_idem_scope_key
|
||||
- createIndex: { tableName: idempotency_keys, indexName: idx_idem_resource, columns: [ {name: resource_id} ] }
|
||||
|
||||
- createIndex:
|
||||
tableName: idempotency_keys
|
||||
indexName: idx_idem_resource
|
||||
columns:
|
||||
- column:
|
||||
name: resource_id
|
||||
|
||||
Reference in New Issue
Block a user