FactuGES_ERP/docs/catalogs/sql/remove-payment-method-system-key.sql
david f1f329fa0d Refactor payment methods: Remove system_key and related logic
- Removed `system_key` from payment method model and related files.
- Updated payment method repository and services to eliminate references to `system_key`.
- Deleted the BootstrapSystemPaymentMethodsService and its use case, as they are no longer needed.
- Adjusted tests to reflect the removal of system payment methods and their associated logic.
- Added SQL script to drop the `system_key` column and its unique index from the database.
2026-08-20 19:37:39 +02:00

36 lines
823 B
SQL

SET @index_exists := (
SELECT COUNT(1)
FROM information_schema.statistics
WHERE table_schema = DATABASE()
AND table_name = 'payment_methods'
AND index_name = 'uq_payment_methods_company_system_key'
);
SET @drop_index_sql := IF(
@index_exists > 0,
'DROP INDEX `uq_payment_methods_company_system_key` ON `payment_methods`',
'SELECT 1'
);
PREPARE stmt FROM @drop_index_sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @column_exists := (
SELECT COUNT(1)
FROM information_schema.columns
WHERE table_schema = DATABASE()
AND table_name = 'payment_methods'
AND column_name = 'system_key'
);
SET @drop_column_sql := IF(
@column_exists > 0,
'ALTER TABLE `payment_methods` DROP COLUMN `system_key`',
'SELECT 1'
);
PREPARE stmt FROM @drop_column_sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;