DO $$
BEGIN
    IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'chk_models_date_source_kind') THEN
        ALTER TABLE models DROP CONSTRAINT chk_models_date_source_kind;
    END IF;

    ALTER TABLE models
        ADD CONSTRAINT chk_models_date_source_kind
        CHECK (
            date_source_kind IN (
                'official_announcement',
                'official_product_page',
                'official_pricing',
                'secondary_authoritative_report',
                'catalog_backfill',
                'unknown'
            )
        );
END $$;

COMMENT ON COLUMN models.date_source_kind IS '发布日期证据来源类型：official_announcement / official_product_page / official_pricing / secondary_authoritative_report / catalog_backfill / unknown';
