39728-vm/db/migrations/2026-05-01_items_notes.sql
2026-05-01 18:08:28 +00:00

15 lines
466 B
SQL

-- Add notes field to products/items for internal product remarks.
-- Safe to run multiple times on existing databases.
SET @db_name := DATABASE();
SET @sql := IF (
EXISTS (
SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db_name AND TABLE_NAME = 'items' AND COLUMN_NAME = 'notes'
),
'SELECT 1',
"ALTER TABLE items ADD COLUMN notes text DEFAULT NULL AFTER image_url"
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;