
alter table jin_role add enhanced_mode int(1) not null default 0 after needapproval;

alter table jin_role modify priv_master_store_packages varchar(50) not null default '';
alter table jin_role modify priv_master_store_products varchar(50) not null default '';
alter table jin_role modify priv_master_store_oneclickords varchar(50) not null default '';
alter table jin_role modify priv_master_store_minisites varchar(50) not null default '';
alter table jin_role modify priv_master_store_jvproducts varchar(50) not null default '';
alter table jin_role modify priv_master_store_specprices varchar(50) not null default '';
alter table jin_role modify priv_master_store_shopcarts varchar(50) not null default '';
alter table jin_role modify priv_master_store_otos varchar(50) not null default '';
alter table jin_role modify priv_master_store_downloads varchar(50) not null default '';
alter table jin_role modify priv_master_store_brandpdfs varchar(50) not null default '';
alter table jin_role modify priv_master_store_memberships varchar(50) not null default '';
alter table jin_role modify priv_master_store_quests varchar(50) not null default '';
alter table jin_role modify priv_master_store_extscripts varchar(50) not null default '';
alter table jin_role modify priv_master_store_taxes varchar(50) not null default '';
alter table jin_role modify priv_master_store_shippings varchar(50) not null default '';

alter table jin_role modify priv_master_customers_sales varchar(50) not null default '';
alter table jin_role modify priv_master_customers_actsubs varchar(50) not null default '';
alter table jin_role modify priv_master_customers_memberships varchar(50) not null default '';
alter table jin_role modify priv_master_customers_quests varchar(50) not null default '';
alter table jin_role modify priv_master_customers_extscripts varchar(50) not null default '';
alter table jin_role modify priv_master_customers_jvmsubs varchar(50) not null default '';
alter table jin_role modify priv_master_customers_shipdue varchar(50) not null default '';

alter table jin_role modify priv_master_affiliates_users varchar(50) not null default '';
alter table jin_role modify priv_master_affiliates_affprogs varchar(50) not null default '';
alter table jin_role modify priv_master_affiliates_series varchar(50) not null default '';
alter table jin_role modify priv_master_affiliates_commissions varchar(50) not null default '';
alter table jin_role modify priv_master_affiliates_paycomms varchar(50) not null default '';
alter table jin_role modify priv_master_affiliates_royalties varchar(50) not null default '';

alter table jin_role modify priv_master_users_all varchar(50) not null default '';
alter table jin_role modify priv_master_users_massmail varchar(50) not null default '';
alter table jin_role modify priv_master_users_massuserop varchar(50) not null default '';
alter table jin_role modify priv_master_users_roles varchar(50) not null default '';
alter table jin_role modify priv_master_users_specusers varchar(50) not null default '';
alter table jin_role modify priv_master_users_downlines varchar(50) not null default '';
alter table jin_role modify priv_master_users_import varchar(50) not null default '';
alter table jin_role modify priv_master_users_invite varchar(50) not null default '';
alter table jin_role modify priv_master_users_approve varchar(50) not null default '';

alter table jin_role modify priv_master_tools_stats varchar(50) not null default '';
alter table jin_role modify priv_master_tools_templates varchar(50) not null default '';
alter table jin_role modify priv_master_tools_emails varchar(50) not null default '';
alter table jin_role modify priv_master_tools_customtags varchar(50) not null default '';
alter table jin_role modify priv_master_tools_forms varchar(50) not null default '';
alter table jin_role modify priv_master_tools_bans varchar(50) not null default '';
alter table jin_role modify priv_master_tools_coupons varchar(50) not null default '';
alter table jin_role modify priv_master_tools_rewards varchar(50) not null default '';
alter table jin_role modify priv_master_tools_shorturls varchar(50) not null default '';
alter table jin_role modify priv_master_tools_export varchar(50) not null default '';
alter table jin_role modify priv_master_tools_pieces varchar(50) not null default '';
alter table jin_role modify priv_master_tools_apiuser varchar(50) not null default '';
alter table jin_role modify priv_master_tools_dbbackup varchar(50) not null default '';

alter table jin_role modify priv_master_plugins_invoicepdfs varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_promogen varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_sponsorships varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_supros varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_banners varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_linkdirs varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_alerts varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_testimonials varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_followupman varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_jvevents varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_affinbs varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_pages varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_geoforce varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_blogpub varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_bcastnews varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_certman varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_clouds varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_multrec varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_reminders varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_helptickets varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_metaaffs varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_contseries varchar(50) not null default '';
alter table jin_role modify priv_master_plugins_lessonman varchar(50) not null default '';

alter table jin_role modify priv_member_account_purchases varchar(50) not null default '';
alter table jin_role modify priv_member_account_mems varchar(50) not null default '';
alter table jin_role modify priv_member_account_jvmsubs varchar(50) not null default '';
alter table jin_role modify priv_member_account_points varchar(50) not null default '';
alter table jin_role modify priv_member_account_helptickets varchar(50) not null default '';

alter table jin_role modify priv_member_promote_affprogs varchar(50) not null default '';
alter table jin_role modify priv_member_promote_links varchar(50) not null default '';
alter table jin_role modify priv_member_promote_campaigns varchar(50) not null default '';
alter table jin_role modify priv_member_promote_commissions varchar(50) not null default '';
alter table jin_role modify priv_member_promote_jvproducts varchar(50) not null default '';
alter table jin_role modify priv_member_promote_royalties varchar(50) not null default '';
alter table jin_role modify priv_member_promote_payroyalties varchar(50) not null default '';

alter table jin_role modify priv_member_downline_view varchar(50) not null default '';
alter table jin_role modify priv_member_downline_massmail varchar(50) not null default '';
alter table jin_role modify priv_member_downline_commissions varchar(50) not null default '';
alter table jin_role modify priv_member_downline_refer varchar(50) not null default '';



create table jin_funnel_step
(
  id                   int(11) not null primary key,
  
  funnel_id            int(11) not null,
  
  title                varchar(255) not null default '',
  
  edit_splitpage_id    int(11) not null default 0
);

create table jin_funnel_splitpage
(
  id                   int(11) not null primary key,

  step_id              int(11) not null,
  
  title                varchar(255) not null default '',
  weight               int(11) not null default 0,
  template             longtext not null default '',
  template_comp        longtext not null default '',

  key(step_id)
);

create table jin_funnel_condition
(
  id                   int(11) not null primary key,

  step_id              int(11) not null,
  ord                  int(3) not null default 0,
  
  cond_type            varchar(10) not null default '',
  cond_obj_id          int(11) not null default 0,
  
  next_step_id         int(11) not null default 0,

  key(step_id)
);

create table jin_funnel_form
(
  id                   int(11) not null primary key,

  funnel_id            int(11) not null,

  type                 varchar(30) not null default '',
  title                varchar(255) not null default '',
  template             longtext not null default '',

  key(funnel_id)
);

create table jin_funnel_visit
(
  funnel_id            int(11) not null,
  code                 char(16) not null default '',

  tstamp               datetime null,

  step_id              int(11) not null default 0,

  action               varchar(15) not null default '',
  param_id             int(11) not null default 0,
  param_text           varchar(255) not null default '',

  user_id              int(11) not null default 0,
  order_id             int(11) not null default 0,

  key(funnel_id),
  key(code)
);

alter table jin_role add priv_master_store_funnels varchar(50) not null default '' after priv_master_store_products;
