-- =========================================================
-- 109_digital_production_print_only_flag.sql
-- Tambah flag per row item produksi untuk kasus cetak only
-- =========================================================

SET @has_is_print_only := (
  SELECT COUNT(*)
  FROM information_schema.COLUMNS
  WHERE TABLE_SCHEMA = DATABASE()
    AND TABLE_NAME = 'digital_production_shift_items'
    AND COLUMN_NAME = 'is_print_only'
);

SET @sql := IF(
  @has_is_print_only = 0,
  'ALTER TABLE digital_production_shift_items ADD COLUMN is_print_only TINYINT(1) NOT NULL DEFAULT 0 AFTER is_long_media',
  'SELECT 1'
);

PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
