use island42;
drop table if exists user;

create table user (
  tid int(11) unique primary key auto_increment,
  ts timestamp NOT NULL,
  dts timestamp NOT NULL default '0',
  editor_user_id int(11) NOT NULL default '0',
  delete_user_id int(11) NOT NULL default '0',

  id int(11) NOT NULL,
  last_logged_in timestamp NOT NULL default '0',
  session blob default NULL,

  user_name varchar(50) NOT NULL default '',
  password varchar(40) NOT NULL default '',

  nickname varchar(50) NOT NULL default '',
  salutation_type_id int(11) NOT NULL default '0',
  first_name varchar(40) NOT NULL default '',
  last_name varchar(40) NOT NULL default '',

  user_status_id int(11) NOT NULL default '1',
  origin_type_id int(11) NOT NULL default '1',

  date_of_birth date null,

  membership_to_be_renewed timestamp null default null,
  membership_to_expire timestamp null default null,

  unsubscribed char(1) NOT NULL default 'f',
  newsletter_unsubscribed char(1) NOT NULL default 'f',
  alerts char(1) NOT NULL default 't',

  holiday_until date not null default '0',
  courtesy_call timestamp null default null
) type=InnoDB;

create index user_i1 on user(id);
create index user_i2 on user(user_name);
create index user_i3 on user(user_status_id);
create index user_i5 on user(dts);

create index user_i7 on user(holiday_until);
create index user_i8 on user(courtesy_call);
create index user_i9 on user(membership_to_be_renewed);
create index user_i10 on user(membership_to_expire);
