- Created complete documentation in docs/ directory - Added PROJECT_OVERVIEW.md with feature highlights and getting started guide - Added ARCHITECTURE.md with system design and technical details - Added SECURITY.md with comprehensive security implementation guide - Added DEVELOPMENT.md with development workflows and best practices - Added DEPLOYMENT.md with production deployment instructions - Added API.md with complete REST API documentation - Added CONTRIBUTING.md with contribution guidelines - Added CHANGELOG.md with version history and migration notes - Reorganized all documentation files into docs/ directory for better organization - Updated README.md with proper documentation links and quick navigation - Enhanced project structure with professional documentation standards
43 lines
1.6 KiB
SQL
43 lines
1.6 KiB
SQL
-- Membership tiers per channel
|
|
CREATE TABLE IF NOT EXISTS `db_membership_tiers` (
|
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
`usr_id` INT UNSIGNED NOT NULL,
|
|
`tier_id` INT UNSIGNED NOT NULL,
|
|
`name` VARCHAR(120) NOT NULL,
|
|
`price_cents` INT UNSIGNED NOT NULL DEFAULT 0,
|
|
`currency` CHAR(3) NOT NULL DEFAULT 'USD',
|
|
`perks_json` TEXT NULL,
|
|
`badge_key` VARCHAR(64) NULL,
|
|
`chat_access` TINYINT(1) NOT NULL DEFAULT 1,
|
|
`active` TINYINT(1) NOT NULL DEFAULT 1,
|
|
PRIMARY KEY (`id`),
|
|
KEY `usr_tier` (`usr_id`,`tier_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
|
|
-- User <> Channel membership relationships
|
|
CREATE TABLE IF NOT EXISTS `db_user_memberships` (
|
|
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
`subscriber_usr_id` INT UNSIGNED NOT NULL,
|
|
`channel_usr_id` INT UNSIGNED NOT NULL,
|
|
`tier_id` INT UNSIGNED NOT NULL,
|
|
`status` ENUM('active','canceled','expired','past_due') NOT NULL DEFAULT 'active',
|
|
`provider` VARCHAR(24) NULL,
|
|
`provider_ref` VARCHAR(128) NULL,
|
|
`started_at` DATETIME NOT NULL,
|
|
`expires_at` DATETIME NULL,
|
|
PRIMARY KEY (`id`),
|
|
KEY `sub_chan` (`subscriber_usr_id`,`channel_usr_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
|
|
-- Optional file access rules
|
|
CREATE TABLE IF NOT EXISTS `db_file_access_rules` (
|
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
`file_key` VARCHAR(32) NOT NULL,
|
|
`type` ENUM('video','live','short','image','audio','doc','blog') NOT NULL DEFAULT 'video',
|
|
`channel_usr_id` INT UNSIGNED NOT NULL,
|
|
`required_tier_id` INT UNSIGNED NOT NULL,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `u_file` (`file_key`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
|