CREATE TABLE IF NOT EXISTS schools (
  id INT AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(255) NOT NULL,
  admin_password_hash VARCHAR(255) NOT NULL,
  plan_status VARCHAR(50) NOT NULL DEFAULT 'free',
  max_notification_limit INT NOT NULL DEFAULT 0,
  current_notification_count INT NOT NULL DEFAULT 0,
  created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS line_members (
  id INT AUTO_INCREMENT PRIMARY KEY,
  line_user_id VARCHAR(255) NOT NULL,
  display_name VARCHAR(255) NOT NULL,
  picture_url VARCHAR(1024) NULL,
  last_login_at DATETIME NOT NULL,
  created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  UNIQUE KEY uq_line_members_line_user_id (line_user_id)
);
