CREATE TABLE IF NOT EXISTS posts (
  id            INT AUTO_INCREMENT PRIMARY KEY,
  title         VARCHAR(255) NOT NULL,
  slug          VARCHAR(160) NOT NULL,
  locale        VARCHAR(8) NOT NULL DEFAULT 'de',
  body_md       MEDIUMTEXT NULL,
  is_published  TINYINT(1) NOT NULL DEFAULT 0,
  created_at    TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at    TIMESTAMP NULL,
  UNIQUE KEY uniq_slug_loc (slug, locale)
) ENGINE=InnoDB;

-- optional: ein Startdatensatz
INSERT INTO posts (title, slug, locale, body_md, is_published)
VALUES ('Hallo Crumb', 'hallo-crumb', 'de', '# Hallo Crumb\n\nDas ist ein Start-Post.', 1)
ON DUPLICATE KEY UPDATE title=VALUES(title);
