CREATE TABLE mgw_config (
  userid INTEGER NOT NULL default '0',
  configtagname CHARACTER VARYING(100) NOT NULL default '0',
  serialnr INTEGER NOT NULL default '0',
  value_str CHARACTER VARYING(255) NOT NULL default '',
  value_int INTEGER NOT NULL default '0',
  value_txt TEXT NOT NULL default '',
  lu_user INTEGER NOT NULL default '0',
  lu_date TIMESTAMP NOT NULL,
  PRIMARY KEY  (userid,configtagname,serialnr)
);

INSERT INTO mgw_config VALUES (0,'iconmode',1,'',0,'',1,'2002-01-01');
INSERT INTO mgw_config VALUES (0,'css_skin_theme',1,'Morelogs_Silver.css',0,'',1,'2002-01-01');
INSERT INTO mgw_config VALUES (0,'language',1,'en',0,'',1,'2002-01-01');
INSERT INTO mgw_config VALUES (0,'iconid',1,'',0,'',1,'2002-01-01');
INSERT INTO mgw_config VALUES (0,'set_timefmt',1,'24h',0,'',1,'2002-01-01');
INSERT INTO mgw_config VALUES (0,'set_hourminsep',1,':',0,'',1,'2002-01-01');
INSERT INTO mgw_config VALUES (0,'set_datefmt',1,'dmY',0,'',1,'2002-01-01');
INSERT INTO mgw_config VALUES (0,'set_dmysep',1,'/',0,'',1,'2002-01-01');
INSERT INTO mgw_config VALUES (0,'currency',1,'eur',0,'',1,'2002-01-01');
INSERT INTO mgw_config VALUES (0,'def_module',1,'overview',0,'',1,'2002-01-01');

CREATE TABLE mgw_configtags (
  configtagname CHARACTER VARYING(100) NOT NULL default '',
  modulename CHARACTER VARYING(100) NOT NULL default '0',
  description CHARACTER VARYING(255) NOT NULL default '',
  multipleselections INTEGER NOT NULL default '0',
  multipledimensions INTEGER NOT NULL default '0',
  valuetype CHARACTER VARYING(5) NOT NULL default '',
  lu_user INTEGER NOT NULL default '0',
  lu_date TIMESTAMP NOT NULL,
  PRIMARY KEY  (configtagname)
);

INSERT INTO mgw_configtags VALUES ('iconmode','*','true if links should be icons, false if links should be text',1,0,'int',1,'2002-01-01');
INSERT INTO mgw_configtags VALUES ('css_skin_theme','*','which CSS file to use / actual theme file',1,0,'str',1,'2002-01-01');
INSERT INTO mgw_configtags VALUES ('language','*','which language to use (language id)',0,0,'str',1,'2002-01-01');
INSERT INTO mgw_configtags VALUES ('iconid','*','Icon Style (for different icon types)',0,0,'int',1,'2001-11-11');
INSERT INTO mgw_configtags VALUES ('set_timefmt','*','12h or 24h time format',0,0,'str',1,'2002-01-01');
INSERT INTO mgw_configtags VALUES ('set_hourminsep','*','seperator in time displays between hour and minute',0,0,'str',1,'2002-01-01');
INSERT INTO mgw_configtags VALUES ('set_datefmt','*','dateformat (settings notation)',0,0,'str',1,'2002-01-01');
INSERT INTO mgw_configtags VALUES ('set_dmysep','*','day-month-year seperator',0,0,'str',1,'2002-01-01');
INSERT INTO mgw_configtags VALUES ('datefmt','*','dateformat PHP date notation',0,0,'str',1,'2002-01-01');
INSERT INTO mgw_configtags VALUES ('timefmt','*','timeformat based on PHP date()',0,0,'str',1,'2002-01-01');
INSERT INTO mgw_configtags VALUES ('currency','*','user currency',0,0,'str',1,'2002-01-01');
INSERT INTO mgw_configtags VALUES ('def_module','*','default module to show',0,0,'str',1,'2002-01-01');

CREATE TABLE mgw_countries (
  name CHARACTER VARYING(100) NOT NULL default '',
  code CHARACTER VARYING(5) NOT NULL default '',
  region CHARACTER VARYING(100) NOT NULL default '',
  lu_date TIMESTAMP NOT NULL,
  lu_user INTEGER NOT NULL default '0',
  PRIMARY KEY  (code)
);

INSERT INTO mgw_countries VALUES ('Afghanistan','AFG','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Albania','ALB','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Algeria','DZA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('American Samoa','ASM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Andorra','AND','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Angola','AGO','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Anguilla','AIA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Antarctica','ATA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Antigua and Barbuda','ATG','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Argentina','ARG','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Armenia','ARM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Aruba','ABW','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Australia','AUS','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Austria','AUT','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Azerbaijan','AZE','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Bahamas','BHS','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Bahrain','BHR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Bangladesh','BGD','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Barbados','BRB','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Belarus','BLR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Belgium','BEL','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Belize','BLZ','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Benin','BEN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Bermuda','BMU','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Bhutan','BTN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Bolivia','BOL','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Bosnia And Herzegowina','BIH','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Botswana','BWA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Bouvet Island','BVT','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Brazil','BRA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('British Indian Ocean Territory','IOT','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Brunei Darussalam','BRN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Bulgaria','BGR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Burkina Faso','BFA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Burundi','BDI','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Cambodia','KHM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Cameroon','CMR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Canada','CAN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Cape Verde','CPV','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Cayman Islands','CYM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Central African Republic','CAF','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Chad','TCD','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Chile','CHL','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('China','CHN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Christmas Island','CXR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Cocos (Keeling) Islands','CCK','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Colombia','COL','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Comoros','COM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Congo','COG','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Cook Islands','COK','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Costa Rica','CRI','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Cote D Ivoire','CIV','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Croatia (Hrvatska)','HRV','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Cyprus','CYP','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Czech Republic','CZE','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Denmark','DNK','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Djibouti','DJI','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Dominica','DMA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Dominican Republic','DOM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('East Timor','TMP','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Ecuador','ECU','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Egypt','EGY','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('El Salvador','SLV','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Equatorial Guinea','GNQ','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Eritrea','ERI','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Estonia','EST','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Ethiopia','ETH','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Falkland Islands (Malvinas)','FLK','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Faroe Islands','FRO','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Fiji','FJI','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Finland','FIN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('France','FRA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('France, Metropolitan','FXX','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('French Guiana','GUF','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('French Polynesia','PYF','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('French Southern Territories','ATF','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Gabon','GAB','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Gambia','GMB','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Georgia','GEO','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Germany','DEU','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Ghana','GHA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Gibraltar','GIB','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Greece','GRC','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Greenland','GRL','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Grenada','GRD','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Guadeloupe','GLP','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Guam','GUM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Guatemala','GTM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Guinea','GIN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Guinea-Bissau','GNB','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Guyana','GUY','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Haiti','HTI','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Heard And McDonald Islands','HMD','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Honduras','HND','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Hong Kong','HKG','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Hungary','HUN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Iceland','ISL','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('India','IND','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Indonesia','IDN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Ireland','IRL','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Israel','ISR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Italy','ITA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Jamaica','JAM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Japan','JPN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Jordan','JOR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Kazakhstan','KAZ','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Kenya','KEN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Kiribati','KIR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Korea, Democratic Peoples Republic Of','PRK','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Korea, Republic Of','KOR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Kuwait','KWT','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Kyrgyzstan','KGZ','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Lao Peoples Democratic Republic','LAO','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Latvia','LVA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Lebanon','LBN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Lesotho','LSO','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Liberia','LBR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Liechtenstein','LIE','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Lithuania','LTU','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Luxembourg','LUX','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Macau','MAC','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Macedonia, Former Yugoslav Republic Of','MKD','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Madagascar','MDG','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Malawi','MWI','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Malaysia','MYS','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Maldives','MDV','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Mali','MLI','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Malta','MLT','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Marshall Islands','MHL','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Martinique','MTQ','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Mauritania','MRT','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Mauritius','MUS','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Mayotte','MYT','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Mexico','MEX','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Micronesia, Federated States Of','FSM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Moldova, Republic Of','MDA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Monaco','MCO','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Mongolia','MNG','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Montserrat','MSR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Morocco','MAR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Mozambique','MOZ','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Myanmar','MMR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Namibia','NAM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Nauru','NRU','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Nepal','NPL','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Netherlands','NLD','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Netherlands Antilles','ANT','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('New Caledonia','NCL','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('New Zealand','NZL','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Nicaragua','NIC','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Niger','NER','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Nigeria','NGA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Niue','NIU','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Norfolk Island','NFK','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Northern Mariana Islands','MNP','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Norway','NOR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Oman','OMN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Pakistan','PAK','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Palau','PLW','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Panama','PAN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Papua New Guinea','PNG','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Paraguay','PRY','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Peru','PER','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Philippines','PHL','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Pitcairn','PCN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Poland','POL','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Portugal','PRT','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Puerto Rico','PRI','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Qatar','QAT','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Reunion','REU','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Romania','ROM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Russian Federation','RUS','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Rwanda','RWA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Saint Kitts And Nevis','KNA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Saint Lucia','LCA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Saint Vincent  Grenadines','VCT','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Samoa','WSM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('San Marino','SMR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Sao Tome And Principe','STP','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Saudi Arabia','SAU','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Senegal','SEN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Seychelles','SYC','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Sierra Leone','SLE','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Singapore','SGP','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Slovakia (Slovak Republic)','SVK','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Slovenia','SVN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Solomon Islands','SLB','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Somalia','SOM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('South Africa','ZAF','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('South Georgia  Sandwich Islands','SGS','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Spain','ESP','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Sri Lanka','LKA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('St. Helena','SHN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('St. Pierre And Miquelon','SPM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Suriname','SUR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Svalbard And Jan Mayen Islands','SJM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Swaziland','SWZ','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Sweden','SWE','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Switzerland','CHE','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Taiwan','TWN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Tajikistan','TJK','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Tanzania, United Republic Of','TZA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Thailand','THA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Togo','TGO','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Tokelau','TKL','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Tonga','TON','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Trinidad And Tobago','TTO','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Tunisia','TUN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Turkey','TUR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Turkmenistan','TKM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Turks And Caicos Islands','TCA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Tuvalu','TUV','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Uganda','UGA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Ukraine','UKR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('United Arab Emirates','ARE','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('United Kingdom','GBR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('United States','USA','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('United States Minor Outlying Islands','UMI','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Uruguay','URY','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Uzbekistan','UZB','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Vanuatu','VUT','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Vatican City State (Holy See)','VAT','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Venezuela','VEN','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Viet Nam','VNM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Virgin Islands (British)','VGB','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Virgin Islands (U.S.)','VIR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Wallis And Futuna Islands','WLF','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Western Sahara','ESH','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Yemen','YEM','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Yugoslavia','YUG','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Zaire','ZAR','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Zambia','ZMB','','2002-01-01',1);
INSERT INTO mgw_countries VALUES ('Zimbabwe','ZWE','','2002-01-01',1);

CREATE TABLE mgw_groups (
  id INTEGER NOT NULL default '0',
  name CHARACTER VARYING(50) NOT NULL default '',
  description CHARACTER VARYING(250) NOT NULL default '',
  lu_user INTEGER NOT NULL default '0',
  lu_date TIMESTAMP NOT NULL,
  PRIMARY KEY  (id,name)
);

INSERT INTO mgw_groups VALUES (50000,'Admin','Admin Group',1,'2002-01-01');
INSERT INTO mgw_groups VALUES (50001,'Default','Default / Standard',1,'2002-01-01');


CREATE TABLE mgw_groups_members (
  groupid INTEGER NOT NULL default '0',
  userid INTEGER NOT NULL default '0',
  lu_user INTEGER NOT NULL default '0',
  lu_date TIMESTAMP NOT NULL,
  PRIMARY KEY  (groupid,userid)
);

INSERT INTO mgw_groups_members VALUES (50000,1,1,'2002-01-01');
INSERT INTO mgw_groups_members VALUES (50001,2,1,'2002-01-01');


CREATE TABLE mgw_languages (
  langcode CHARACTER VARYING(5) NOT NULL default '',
  description CHARACTER VARYING(100) NOT NULL default '',
  charset CHARACTER VARYING(30) NOT NULL default '',
  active INTEGER NOT NULL default '0',
  lu_user INTEGER NOT NULL default '0',
  lu_date TIMESTAMP NOT NULL,
  PRIMARY KEY  (langcode)
);

INSERT INTO mgw_languages VALUES ('en','English','ISO-8859-1',1,1,'2002-01-01');
INSERT INTO mgw_languages VALUES ('fr','French','ISO-8859-1',1,1,'2002-01-01');
INSERT INTO mgw_languages VALUES ('zh_cn','Chinese (Simplified)','GB2312',1,1,'2002-01-01');
INSERT INTO mgw_languages VALUES ('zh_tw','Chinese (Traditional)','Big5',1,1,'2002-01-01');

CREATE TABLE mgw_modules (
  modulename CHARACTER VARYING(30) NOT NULL default '',
  description CHARACTER VARYING(250) NOT NULL default '',
  folder CHARACTER VARYING(50) default NULL,
  displevel INTEGER default NULL,
  active INTEGER default NULL,
  lu_user INTEGER NOT NULL default '0',
  lu_date TIMESTAMP NOT NULL,
  PRIMARY KEY  (modulename)
);

CREATE TABLE mgw_rights (
  modulename CHARACTER VARYING(50) NOT NULL default '0',
  user_group_id INTEGER NOT NULL default '0',
  _read INTEGER NOT NULL default '0',
  _write INTEGER NOT NULL default '0',
  _delete INTEGER NOT NULL default '0',
  _delete_others INTEGER NOT NULL default '0',
  _modify INTEGER NOT NULL default '0',
  _modify_others INTEGER NOT NULL default '0',
  _module_level INTEGER NOT NULL default '0',
  lu_user INTEGER NOT NULL default '0',
  lu_date TIMESTAMP NOT NULL,
  PRIMARY KEY  (modulename,user_group_id)
);
