create table marketplaces
(
    id               serial
        primary key,
    base_marketplace integer not null,
    name             varchar not null,
    auth_data        varchar,
    warehouse_id     varchar,
    auth_data_json   jsonb generated always as (
        CASE
            WHEN ((auth_data)::text IS JSON) THEN (auth_data)::jsonb
            ELSE NULL::jsonb
            END) stored,
    campaign_id      varchar
);