-- Run this SQL in phpMyAdmin or via CLI:
-- mysql -u iconicbi_ytd -p iconicbi_ytd < licenses.sql

CREATE TABLE IF NOT EXISTS `yttd_licenses` (
  `id`           INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `license_key`  VARCHAR(64)  NOT NULL,
  `email`        VARCHAR(255) NOT NULL DEFAULT '',
  `order_id`     VARCHAR(128) NOT NULL DEFAULT '',
  `status`       ENUM('active','inactive','expired') NOT NULL DEFAULT 'active',
  `activations`  SMALLINT     NOT NULL DEFAULT 0,
  `domains`      TEXT         NOT NULL,
  `expires_at`   DATE         NULL DEFAULT NULL,
  `created_at`   DATETIME     NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_key` (`license_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
