-- ============================================================
-- profile_sections — custom sections added by members
-- Run once against your database.
-- ============================================================
CREATE TABLE IF NOT EXISTS `profile_sections` (
    `id`            INT UNSIGNED     NOT NULL AUTO_INCREMENT,
    `profile_id`    INT UNSIGNED     NOT NULL,
    `section_type`  ENUM('text','photo','video','document') NOT NULL DEFAULT 'text',
    `title`         VARCHAR(255)     NOT NULL,
    `content`       TEXT             NULL DEFAULT NULL,      -- body text (text type) or caption
    `file_path`     VARCHAR(500)     NULL DEFAULT NULL,      -- photo / document disk path
    `url`           VARCHAR(1000)    NULL DEFAULT NULL,      -- video embed URL
    `original_name` VARCHAR(255)     NULL DEFAULT NULL,
    `file_size`     INT UNSIGNED     NULL DEFAULT NULL,
    `mime_type`     VARCHAR(100)     NULL DEFAULT NULL,
    `sort_order`    SMALLINT         NOT NULL DEFAULT 0,
    `is_visible`    TINYINT(1)       NOT NULL DEFAULT 1,
    `created_at`    DATETIME         NULL DEFAULT NULL,
    `updated_at`    DATETIME         NULL DEFAULT NULL,
    PRIMARY KEY (`id`),
    INDEX `idx_ps_profile`  (`profile_id`),
    INDEX `idx_ps_type`     (`section_type`),
    INDEX `idx_ps_sort`     (`profile_id`, `sort_order`, `id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
