Align origin/main with upstream/main (GitHub). The two branches diverged due to pre-rebase vs post-rebase merge commits for the k8s-amd64-dockerfiles feature. Includes: multi-stage Go compilation Dockerfiles, pan-bolt inventory features, CRM relations, Excel import tooling, proto/gRPC updates, migration scripts, and tools/ directory. Excludes deploy/bin/ pre-compiled binaries (arm64, not needed for amd64 K3s cluster; builds use multi-stage Dockerfiles now).
27 lines
1.7 KiB
SQL
27 lines
1.7 KiB
SQL
-- Remove deprecated flat columns from inv_product.
|
|
-- Must run AFTER 20260403_data_migration.sql has migrated existing rows.
|
|
-- Uses PREPARE/EXECUTE to skip each column that was already dropped
|
|
-- (MySQL has no DROP COLUMN IF EXISTS; that is a MariaDB-only extension).
|
|
|
|
SET @db = DATABASE();
|
|
|
|
SET @c = (SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=@db AND TABLE_NAME='inv_product' AND COLUMN_NAME='unit_pieces');
|
|
SET @s = IF(@c=1, 'ALTER TABLE `inv_product` DROP COLUMN `unit_pieces`', 'SELECT 1');
|
|
PREPARE stmt FROM @s; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
|
|
|
SET @c = (SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=@db AND TABLE_NAME='inv_product' AND COLUMN_NAME='unit_rolls');
|
|
SET @s = IF(@c=1, 'ALTER TABLE `inv_product` DROP COLUMN `unit_rolls`', 'SELECT 1');
|
|
PREPARE stmt FROM @s; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
|
|
|
SET @c = (SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=@db AND TABLE_NAME='inv_product' AND COLUMN_NAME='stock_quantity');
|
|
SET @s = IF(@c=1, 'ALTER TABLE `inv_product` DROP COLUMN `stock_quantity`', 'SELECT 1');
|
|
PREPARE stmt FROM @s; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
|
|
|
SET @c = (SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=@db AND TABLE_NAME='inv_product' AND COLUMN_NAME='location');
|
|
SET @s = IF(@c=1, 'ALTER TABLE `inv_product` DROP COLUMN `location`', 'SELECT 1');
|
|
PREPARE stmt FROM @s; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
|
|
|
SET @c = (SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=@db AND TABLE_NAME='inv_product' AND COLUMN_NAME='cost_price');
|
|
SET @s = IF(@c=1, 'ALTER TABLE `inv_product` DROP COLUMN `cost_price`', 'SELECT 1');
|
|
PREPARE stmt FROM @s; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|