CREATE TABLE IF NOT EXISTS articles_categories (
  id INT AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(255) NOT NULL,
  bg VARCHAR(20) DEFAULT '#534AB7',
  font VARCHAR(20) DEFAULT '#ffffff',
  icon TEXT,
  sort_order INT DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS articles_articles (
  id INT AUTO_INCREMENT PRIMARY KEY,
  title VARCHAR(500) NOT NULL,
  student VARCHAR(255) DEFAULT '',
  cat_id INT DEFAULT NULL,
  `text` MEDIUMTEXT,
  sort_order INT DEFAULT 0,
  FOREIGN KEY (cat_id) REFERENCES articles_categories(id) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
