alter table jin_cmsmem add insecure int(1) not null default 0 after path;
alter table jin_product add master_cmsmems varchar(100) not null default '' after master_rmems;

rename table jin_user_settings to jin_merchant_settings;

alter table jin_merchant_settings add sitename varchar(255) not null default '' after owner_id;
alter table jin_merchant_settings add turboaffid varchar(255) not null default '' after sitename;
alter table jin_merchant_settings add help_url_forum varchar(255) not null default '' after turboaffid;
alter table jin_merchant_settings add help_url_helpdesk varchar(255) not null default '' after help_url_forum;

alter table jin_user add pg_paypal_email varchar(255) not null default '' after tax_id;
alter table jin_user add no_admin_mail int(1) not null default 0 after pg_paypal_email;
alter table jin_user add no_upline_mail int(1) not null default 0 after no_admin_mail;

alter table jin_merchant_settings add welcome_screen text not null default '' after currency;

# use-sell point

alter table jin_role add priv_master_tools_exportcomms int(1) not null default 0 after priv_master_tools_importpieces;

alter table jin_product add embed_prods varchar(100) not null default '' after master_cmsmems;
alter table jin_product add embed_prods_recur varchar(100) not null default '' after embed_prods;
alter table jin_sale add container_sale_id int(11) not null default 0 after aff_camp_id;
create index container_sale_id on jin_sale(owner_id,container_sale_id);

alter table jin_user_role add expired int(1) not null default 0 after expires;
alter table jin_user_affprog add expired int(1) not null default 0 after expires;
alter table jin_user_resprog add expired int(1) not null default 0 after expires;
alter table jin_user_lmem add expired int(1) not null default 0 after expires;
alter table jin_user_rmem add expired int(1) not null default 0 after expires;
alter table jin_user_cmsmem add expired int(1) not null default 0 after expires;
alter table jin_user_quest add expired int(1) not null default 0 after expires;

update jin_user_role set expired=1 where expires is not null and to_days(expires)<=to_days(now());
update jin_user_affprog set expired=1 where expires is not null and to_days(expires)<=to_days(now());
update jin_user_resprog set expired=1 where expires is not null and to_days(expires)<=to_days(now());
update jin_user_lmem set expired=1 where expires is not null and to_days(expires)<=to_days(now());
update jin_user_rmem set expired=1 where expires is not null and to_days(expires)<=to_days(now());
update jin_user_cmsmem set expired=1 where expires is not null and to_days(expires)<=to_days(now());
update jin_user_quest set expired=1 where expires is not null and to_days(expires)<=to_days(now());

alter table jin_merchant_settings add limit_user_reg_ip int(4) not null default 0 after currency;
alter table jin_user add reg_ip varchar(32) not null default '' after sestime;

create index reg_ip on jin_user(reg_ip);

alter table jin_ext_script add title varchar(255) not null after owner_id;
update jin_ext_script set title=url;

alter table jin_product change dlv_oto dlv_otos varchar(255) not null default '';
alter table jin_oto add next_oto_link_title varchar(255) not null default '' after paylink_title;
alter table jin_oto change paylink_style links_style varchar(30) not null default '';
alter table jin_sale modify oto_shown int(11) not null default 0;

