-- Table: mdl_external_user

-- DROP TABLE mdl_external_user;

CREATE TABLE mdl_external_user
(
  id bigserial NOT NULL,
  auth character varying(20) NOT NULL DEFAULT 'manual'::character varying,
  confirmed smallint NOT NULL DEFAULT 0,
  policyagreed smallint NOT NULL DEFAULT 0,
  deleted smallint NOT NULL DEFAULT 0,
  suspended smallint NOT NULL DEFAULT 0,
  mnethostid bigint NOT NULL DEFAULT 0,
  username character varying(100) NOT NULL DEFAULT ''::character varying,
  password character varying(255) NOT NULL DEFAULT ''::character varying,
  idnumber character varying(255) NOT NULL DEFAULT ''::character varying,
  firstname character varying(100) NOT NULL DEFAULT ''::character varying,
  lastname character varying(100) NOT NULL DEFAULT ''::character varying,
  email character varying(100) NOT NULL DEFAULT ''::character varying,
  emailstop smallint NOT NULL DEFAULT 0,
  icq character varying(15) NOT NULL DEFAULT ''::character varying,
  skype character varying(50) NOT NULL DEFAULT ''::character varying,
  yahoo character varying(50) NOT NULL DEFAULT ''::character varying,
  aim character varying(50) NOT NULL DEFAULT ''::character varying,
  msn character varying(50) NOT NULL DEFAULT ''::character varying,
  phone1 character varying(20) NOT NULL DEFAULT ''::character varying,
  phone2 character varying(20) NOT NULL DEFAULT ''::character varying,
  institution character varying(255) NOT NULL DEFAULT ''::character varying,
  department character varying(255) NOT NULL DEFAULT ''::character varying,
  address character varying(255) NOT NULL DEFAULT ''::character varying,
  city character varying(120) NOT NULL DEFAULT ''::character varying,
  country character varying(2) NOT NULL DEFAULT ''::character varying,
  lang character varying(30) NOT NULL DEFAULT 'en'::character varying,
  calendartype character varying(30) NOT NULL DEFAULT 'gregorian'::character varying,
  theme character varying(50) NOT NULL DEFAULT ''::character varying,
  timezone character varying(100) NOT NULL DEFAULT '99'::character varying,
  firstaccess bigint NOT NULL DEFAULT 0,
  lastaccess bigint NOT NULL DEFAULT 0,
  lastlogin bigint NOT NULL DEFAULT 0,
  currentlogin bigint NOT NULL DEFAULT 0,
  lastip character varying(45) NOT NULL DEFAULT ''::character varying,
  secret character varying(15) NOT NULL DEFAULT ''::character varying,
  picture bigint NOT NULL DEFAULT 0,
  url character varying(255) NOT NULL DEFAULT ''::character varying,
  description text,
  descriptionformat smallint NOT NULL DEFAULT 1,
  mailformat smallint NOT NULL DEFAULT 1,
  maildigest smallint NOT NULL DEFAULT 0,
  maildisplay smallint NOT NULL DEFAULT 2,
  autosubscribe smallint NOT NULL DEFAULT 1,
  trackforums smallint NOT NULL DEFAULT 0,
  timecreated bigint NOT NULL DEFAULT 0,
  timemodified bigint NOT NULL DEFAULT 0,
  trustbitmask bigint NOT NULL DEFAULT 0,
  imagealt character varying(255),
  lastnamephonetic character varying(255),
  firstnamephonetic character varying(255),
  middlename character varying(255),
  alternatename character varying(255),
  CONSTRAINT mdl_external_user_id_pk PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE mdl_external_user
  OWNER TO postgres;
COMMENT ON TABLE mdl_external_user
  IS 'One record for each person';

-- Index: mdl_external_user_alt_ix

-- DROP INDEX mdl_external_user_alt_ix;

CREATE INDEX mdl_external_user_alt_ix
  ON mdl_external_user
  USING btree
  (alternatename COLLATE pg_catalog."default");

-- Index: mdl_external_user_aut_ix

-- DROP INDEX mdl_external_user_aut_ix;

CREATE INDEX mdl_external_user_aut_ix
  ON mdl_external_user
  USING btree
  (auth COLLATE pg_catalog."default");

-- Index: mdl_external_user_cit_ix

-- DROP INDEX mdl_external_user_cit_ix;

CREATE INDEX mdl_external_user_cit_ix
  ON mdl_external_user
  USING btree
  (city COLLATE pg_catalog."default");

-- Index: mdl_external_user_con_ix

-- DROP INDEX mdl_external_user_con_ix;

CREATE INDEX mdl_external_user_con_ix
  ON mdl_external_user
  USING btree
  (confirmed);

-- Index: mdl_external_user_cou_ix

-- DROP INDEX mdl_external_user_cou_ix;

CREATE INDEX mdl_external_user_cou_ix
  ON mdl_external_user
  USING btree
  (country COLLATE pg_catalog."default");

-- Index: mdl_external_user_del_ix

-- DROP INDEX mdl_external_user_del_ix;

CREATE INDEX mdl_external_user_del_ix
  ON mdl_external_user
  USING btree
  (deleted);

-- Index: mdl_external_user_ema_ix

-- DROP INDEX mdl_external_user_ema_ix;

CREATE INDEX mdl_external_user_ema_ix
  ON mdl_external_user
  USING btree
  (email COLLATE pg_catalog."default");

-- Index: mdl_external_user_fir2_ix

-- DROP INDEX mdl_external_user_fir2_ix;

CREATE INDEX mdl_external_user_fir2_ix
  ON mdl_external_user
  USING btree
  (firstnamephonetic COLLATE pg_catalog."default");

-- Index: mdl_external_user_fir_ix

-- DROP INDEX mdl_external_user_fir_ix;

CREATE INDEX mdl_external_user_fir_ix
  ON mdl_external_user
  USING btree
  (firstname COLLATE pg_catalog."default");

-- Index: mdl_external_user_idn_ix

-- DROP INDEX mdl_external_user_idn_ix;

CREATE INDEX mdl_external_user_idn_ix
  ON mdl_external_user
  USING btree
  (idnumber COLLATE pg_catalog."default");

-- Index: mdl_external_user_las2_ix

-- DROP INDEX mdl_external_user_las2_ix;

CREATE INDEX mdl_external_user_las2_ix
  ON mdl_external_user
  USING btree
  (lastaccess);

-- Index: mdl_external_user_las3_ix

-- DROP INDEX mdl_external_user_las3_ix;

CREATE INDEX mdl_external_user_las3_ix
  ON mdl_external_user
  USING btree
  (lastnamephonetic COLLATE pg_catalog."default");

-- Index: mdl_external_user_las_ix

-- DROP INDEX mdl_external_user_las_ix;

CREATE INDEX mdl_external_user_las_ix
  ON mdl_external_user
  USING btree
  (lastname COLLATE pg_catalog."default");

-- Index: mdl_external_user_mid_ix

-- DROP INDEX mdl_external_user_mid_ix;

CREATE INDEX mdl_external_user_mid_ix
  ON mdl_external_user
  USING btree
  (middlename COLLATE pg_catalog."default");

-- Index: mdl_external_user_mneuse_uix

-- DROP INDEX mdl_external_user_mneuse_uix;

CREATE UNIQUE INDEX mdl_external_user_mneuse_uix
  ON mdl_external_user
  USING btree
  (mnethostid, username COLLATE pg_catalog."default");


