Implement warehouse/lot pricing updates and configurator performance fixes
This commit is contained in:
2
migrations/019_rename_stock_log_lot_to_partnumber.sql
Normal file
2
migrations/019_rename_stock_log_lot_to_partnumber.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE stock_log
|
||||
CHANGE COLUMN lot partnumber VARCHAR(255) NOT NULL;
|
||||
3
migrations/020_add_only_in_stock_to_configurations.sql
Normal file
3
migrations/020_add_only_in_stock_to_configurations.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
-- Add only_in_stock toggle to configuration settings persisted in MariaDB.
|
||||
ALTER TABLE qt_configurations
|
||||
ADD COLUMN IF NOT EXISTS only_in_stock BOOLEAN NOT NULL DEFAULT FALSE AFTER disable_price_refresh;
|
||||
19
migrations/021_add_pricelist_items_pricelist_lot_index.sql
Normal file
19
migrations/021_add_pricelist_items_pricelist_lot_index.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- Ensure fast lookup for /api/quote/price-levels batched queries:
|
||||
-- SELECT ... FROM qt_pricelist_items WHERE pricelist_id = ? AND lot_name IN (...)
|
||||
SET @has_idx := (
|
||||
SELECT COUNT(1)
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = DATABASE()
|
||||
AND table_name = 'qt_pricelist_items'
|
||||
AND index_name IN ('idx_qt_pricelist_items_pricelist_lot', 'idx_pricelist_lot')
|
||||
);
|
||||
|
||||
SET @ddl := IF(
|
||||
@has_idx = 0,
|
||||
'ALTER TABLE qt_pricelist_items ADD INDEX idx_qt_pricelist_items_pricelist_lot (pricelist_id, lot_name)',
|
||||
'SELECT ''idx_qt_pricelist_items_pricelist_lot already exists, skip'''
|
||||
);
|
||||
|
||||
PREPARE stmt FROM @ddl;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
Reference in New Issue
Block a user