BEGIN;

/*
DROP TABLE public.ods_payment_order;
*/

-- Type: TABLE ; Name: ods_payment_order; Owner: sdk_statis_developer

CREATE TABLE public.ods_payment_order (
    gmid bigint,
    appid bigint NOT NULL,
    app_ver text,
    sdk_ver text,
    channel text,
    country text,
    province text,
    city text,
    isp text,
    ip text,
    device_id text,
    device_model text,
    device_brand text,
    device_os text,
    device_type text,
    event_time bigint,
    user_id text,
    order_id text NOT NULL,
    amount bigint,
    platform text,
    servid text,
    role_id text,
    prodid text,
    prod_name text,
    status integer NOT NULL,
    ds text NOT NULL
    ,PRIMARY KEY (appid, order_id, status)
) WITH (
orientation = 'column',
storage_format = 'orc',
binlog_level = 'replica',
binlog_ttl = '604800',
bitmap_columns = 'appid,device_id,servid,order_id,user_id,status,ds,event_time',
clustering_key = 'ds:asc',
dictionary_encoding_columns = '',
distribution_key = 'appid',
table_group = 'sdk_statis_tg_s80',
table_storage_mode = 'any',
time_to_live_in_seconds = '3153600000'
);



COMMENT ON TABLE public.ods_payment_order IS NULL;
COMMENT ON COLUMN public.ods_payment_order.status IS '0预支付/1已支付';
COMMENT ON COLUMN public.ods_payment_order.ds IS 'yyyymmdd';


END;






BEGIN;

/*
DROP TABLE public.ods_active_role;
*/

-- Type: TABLE ; Name: ods_active_role; Owner: sdk_statis_developer

CREATE TABLE public.ods_active_role (
    appid bigint NOT NULL,
    channel text NOT NULL,
    role_id text NOT NULL,
    ds text NOT NULL,
    gmid bigint,
    app_ver text,
    sdk_ver text,
    country text,
    province text,
    city text,
    isp text,
    ip text,
    device_id text,
    device_model text,
    device_brand text,
    device_os text,
    device_type text,
    event_time bigint,
    user_id text,
    servid text,
    job_id text,
    role_level text,
    role_name text,
    job_name text,
    server_name text
    ,PRIMARY KEY (appid, channel, role_id, ds)
) WITH (
orientation = 'column',
storage_format = 'orc',
bitmap_columns = 'appid,ds',
clustering_key = 'ds:asc',
dictionary_encoding_columns = '',
distribution_key = 'appid,role_id,ds',
table_group = 'sdk_statis_tg_s80',
table_storage_mode = 'any',
time_to_live_in_seconds = '31536000'
);



COMMENT ON TABLE public.ods_active_role IS NULL;
ALTER TABLE public.ods_active_role OWNER TO sdk_statis_developer;


END;



BEGIN;

/*
DROP TABLE public.ads_app_statis_md;
*/

-- Type: TABLE ; Name: ads_app_statis_md; Owner: sdk_statis_developer

CREATE TABLE public.ads_app_statis_md (
    gmid integer NOT NULL,
    appid integer NOT NULL,
    app_ver text NOT NULL,
    channel text NOT NULL,
    newly_device bigint,
    newly_account bigint,
    active_device bigint,
    active_account bigint,
    payment_device bigint,
    payment_account bigint,
    order_created bigint,
    order_amount bigint,
    order_payment bigint,
    ds text NOT NULL,
    new_role_users bigint,
    new_roles bigint,
    new_pay_account bigint,
    new_ac_amount bigint,
    new_ac_pay_num bigint,
    new_pay_user bigint,
    new_user_amount bigint,
    payment_order bigint
    ,PRIMARY KEY (gmid, appid, app_ver, channel, ds)
) WITH (
orientation = 'column',
storage_format = 'orc',
bitmap_columns = 'app_ver,channel,ds',
dictionary_encoding_columns = 'app_ver:auto,channel:auto,ds:auto',
distribution_key = 'gmid,appid,app_ver,channel,ds',
table_group = 'sdk_statis_tg_s80',
table_storage_mode = 'any',
time_to_live_in_seconds = '3153600000'
);



COMMENT ON TABLE public.ads_app_statis_md IS NULL;
ALTER TABLE public.ads_app_statis_md OWNER TO sdk_statis_developer;
COMMENT ON COLUMN public.ads_app_statis_md.newly_device IS '新增设备';
COMMENT ON COLUMN public.ads_app_statis_md.newly_account IS '新增账号';
COMMENT ON COLUMN public.ads_app_statis_md.active_device IS '活跃设备';
COMMENT ON COLUMN public.ads_app_statis_md.active_account IS '活跃账号';
COMMENT ON COLUMN public.ads_app_statis_md.payment_device IS '付费设备';
COMMENT ON COLUMN public.ads_app_statis_md.payment_account IS '付费账号';
COMMENT ON COLUMN public.ads_app_statis_md.order_created IS '创建订单数';
COMMENT ON COLUMN public.ads_app_statis_md.order_amount IS '订单总金额';
COMMENT ON COLUMN public.ads_app_statis_md.order_payment IS '订单实付款';
COMMENT ON COLUMN public.ads_app_statis_md.ds IS '统计月份yyyy-mm';
COMMENT ON COLUMN public.ads_app_statis_md.new_role_users IS '新增创角账号数';
COMMENT ON COLUMN public.ads_app_statis_md.new_roles IS '新增创建角色数';
COMMENT ON COLUMN public.ads_app_statis_md.new_pay_account IS '新增付费账号数';
COMMENT ON COLUMN public.ads_app_statis_md.new_ac_amount IS '新增付费金额（账号）';
COMMENT ON COLUMN public.ads_app_statis_md.new_ac_pay_num IS '新增付费次数';
COMMENT ON COLUMN public.ads_app_statis_md.new_pay_user IS '新增付费用户数';
COMMENT ON COLUMN public.ads_app_statis_md.new_user_amount IS '新增付费用户付费金额';
COMMENT ON COLUMN public.ads_app_statis_md.payment_order IS '付费订单数';


END;