CREATE TABLE IF NOT EXISTS ride_posts (
  id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  author_user_id BIGINT UNSIGNED NOT NULL,
  title VARCHAR(140) NOT NULL,
  body TEXT NOT NULL,
  sport VARCHAR(40) NOT NULL,
  province CHAR(2) NULL,
  meeting_area VARCHAR(191) NULL,
  ride_time DATETIME NULL,
  open_to_join TINYINT(1) NOT NULL DEFAULT 1,
  seats SMALLINT UNSIGNED NULL,
  status ENUM('active','closed','hidden','flagged') NOT NULL DEFAULT 'active',
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  CONSTRAINT fk_ride_posts_user FOREIGN KEY (author_user_id) REFERENCES users(id) ON DELETE CASCADE,
  INDEX idx_ride_posts_created (created_at),
  INDEX idx_ride_posts_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
