
alter table jin_funnel_visit add tstamp_start datetime null after code;
alter table jin_funnel_visit add seq int(3) not null default 0 after tstamp;
alter table jin_funnel_visit add user_ip varchar(50) not null default '';
alter table jin_funnel_visit add user_cookie varchar(50) not null default '';

update jin_funnel_visit set user_cookie=code where user_cookie='';

create table jin_funnel_splitstat
(
  splittest_id         int(11) not null,

  splitpage_id         int(11) not null,

  visit_code           char(16) not null default '',

  uni                  int(11) not null default 0,
  act                  int(11) not null default 0,

  user_cookie          varchar(32) not null default '',
  order_id             int(11) not null default 0,

  key(splittest_id,splitpage_id,visit_code,uni,act)
);

update jin_sale set tstamp=ctime where subscr_not_initial=1 and to_days(ctime)-to_days(tstamp)>1;


alter table jin_embedded_email add user_register_confirm text not null default '' after user_register;
update jin_embedded_email set user_register_confirm=user_register;
update jin_embedded_email set user_register='';

alter table jin_merchant_settings add reg_1optin int(1) not null default 0 after aff_cookie_mode;
alter table jin_merchant_settings add reg_cfm_url varchar(255) not null default '' after reg_1optin;
alter table jin_merchant_settings add reg_api_post varchar(255) not null default '' after reg_cfm_url;

alter table jin_package add api_post_regcfm varchar(255) not null default '' after api_post_notifysale;

drop index funnel_id on jin_funnel_visit;
create index funnel_id on jin_funnel_visit(funnel_id,step_id);

alter table jin_funnel_splittest add dec_prec int(1) not null default 0 after visit_delay;
