-- site_pages.page_template: vitrin şablonu (content | contact | about | legal)
USE faunamix;

SET @col_exists = (
  SELECT COUNT(*) FROM information_schema.COLUMNS
  WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'site_pages' AND COLUMN_NAME = 'page_template'
);

SET @sql = IF(
  @col_exists = 0,
  "ALTER TABLE site_pages ADD COLUMN page_template VARCHAR(32) NOT NULL DEFAULT 'content' AFTER path",
  'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

UPDATE site_pages SET page_template = 'about' WHERE path = '/hakkimizda' AND page_template = 'content';
