CREATE DATABASE IF NOT EXISTS `CHANGE_ME_DATABASE_NAME` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
USE `CHANGE_ME_DATABASE_NAME`;

CREATE TABLE IF NOT EXISTS contact_messages (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  name VARCHAR(150) NOT NULL,
  email VARCHAR(190) NOT NULL,
  message TEXT NOT NULL,
  submitted_at DATETIME NOT NULL,
  ip_address VARCHAR(45) NULL,
  PRIMARY KEY (id),
  KEY idx_contact_submitted_at (submitted_at),
  KEY idx_contact_email (email)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS prayer_requests (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  name VARCHAR(150) NOT NULL,
  email VARCHAR(190) DEFAULT NULL,
  prayer TEXT NOT NULL,
  status VARCHAR(40) NOT NULL DEFAULT 'new',
  submitted_at DATETIME NOT NULL,
  ip_address VARCHAR(45) NULL,
  PRIMARY KEY (id),
  KEY idx_prayer_submitted_at (submitted_at),
  KEY idx_prayer_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS giving_notices (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  name VARCHAR(150) NOT NULL,
  email VARCHAR(190) NOT NULL,
  amount VARCHAR(80) NOT NULL,
  note TEXT NULL,
  status VARCHAR(40) NOT NULL DEFAULT 'new',
  submitted_at DATETIME NOT NULL,
  ip_address VARCHAR(45) NULL,
  PRIMARY KEY (id),
  KEY idx_giving_submitted_at (submitted_at),
  KEY idx_giving_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
