CREATE TABLE IF NOT EXISTS app_records (
    id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
    collection VARCHAR(100) NOT NULL,
    record_id BIGINT UNSIGNED NOT NULL,
    payload LONGTEXT NOT NULL,
    created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    UNIQUE KEY app_records_collection_record_unique (collection, record_id),
    KEY app_records_collection_index (collection)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
