-- user_user.sql
DROP TABLE IF EXISTS useruser_corefeature_rel;
DROP TABLE IF EXISTS user_confirm;
DROP TABLE IF EXISTS user_detail;
DROP TABLE IF EXISTS user_user;

-- core.sql
DROP TABLE IF EXISTS core_feature;
DROP TABLE IF EXISTS core_feature_translation;
DROP TABLE IF EXISTS core_config;
DROP TABLE IF EXISTS core_translation;
DROP TABLE IF EXISTS core_country;
DROP TABLE IF EXISTS core_lang;
DROP TABLE IF EXISTS core_currency;
DROP TABLE IF EXISTS core_theme;

CREATE TABLE core_theme (
	id SERIAL,
	create_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
	code VARCHAR(16) NOT NULL,
	name VARCHAR(128) NOT NULL,
	is_prod_available BOOLEAN NOT NULL DEFAULT FALSE,
  is_active BOOLEAN NOT NULL DEFAULT TRUE,
	CONSTRAINT coreTheme_id_pk PRIMARY KEY(id),
	CONSTRAINT coreTheme_code_uk UNIQUE(id)
);

CREATE TABLE core_currency (
  id SERIAL,
  create_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  code VARCHAR(16) NOT NULL,
  name VARCHAR(128) NOT NULL,
  symbol VARCHAR(16) NOT NULL,
  rounding DECIMAL(12,8) NOT NULL,
  priority INTEGER NOT NULL DEFAULT 100,
  decimal_precision INTEGER NOT NULL DEFAULT 2,
  is_active BOOLEAN NOT NULL DEFAULT TRUE,
  CONSTRAINT coreCurrency_id_pk PRIMARY KEY(id),
  CONSTRAINT coreCurrency_name_uk UNIQUE(name),
  CONSTRAINT coreCurrency_name_chk CHECK(name !='')
);

CREATE TABLE core_lang (
  id SERIAL,
  create_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  code VARCHAR(16) NOT NULL,
  name VARCHAR(128) NOT NULL,
  is_active BOOLEAN NOT NULL DEFAULT FALSE,
  comment TEXT NOT NULL DEFAULT '',
  CONSTRAINT coreLang_id_pk PRIMARY KEY(id),
  CONSTRAINT coreLang_name_uk UNIQUE(name)
);

CREATE TABLE core_country (
  id SERIAL,
  create_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  code VARCHAR(16) NOT NULL,
  name VARCHAR(128) NOT NULL,
  core_currency_id INTEGER,
  priority INTEGER NOT NULL DEFAULT 100,
  is_active BOOLEAN NOT NULL DEFAULT TRUE,
  CONSTRAINT coreCountry_id_pk PRIMARY KEY(id),
  CONSTRAINT coreCountry_code_uk UNIQUE(code),
  CONSTRAINT coreCountry_code_chk CHECK(code !=''),
  CONSTRAINT coreCountry_name_chk CHECK(name !=''),
  CONSTRAINT coreCountry_coreCurrencyId_fk FOREIGN KEY(core_currency_id) REFERENCES core_currency(id)
);

CREATE TABLE core_translation (
  id SERIAL,
  create_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  code VARCHAR(128) NOT NULL,
  source TEXT NOT NULL,
  ab_RU TEXT NOT NULL DEFAULT '',
  am_ET TEXT NOT NULL DEFAULT '',
  ar_SY TEXT NOT NULL DEFAULT '',
  bg_BG TEXT NOT NULL DEFAULT '',
  bs_BS TEXT NOT NULL DEFAULT '',
  ca_ES TEXT NOT NULL DEFAULT '',
  cs_CZ TEXT NOT NULL DEFAULT '',
  da_DK TEXT NOT NULL DEFAULT '',
  de_DE TEXT NOT NULL DEFAULT '',
  el_GR TEXT NOT NULL DEFAULT '',
  en_CA TEXT NOT NULL DEFAULT '',
  en_gb TEXT NOT NULL DEFAULT '',
  en_US TEXT NOT NULL DEFAULT '',
  es_AR TEXT NOT NULL DEFAULT '',
  es_BO TEXT NOT NULL DEFAULT '',
  es_CL TEXT NOT NULL DEFAULT '',
  es_CO TEXT NOT NULL DEFAULT '',
  es_CR TEXT NOT NULL DEFAULT '',
  es_DO TEXT NOT NULL DEFAULT '',
  es_EC TEXT NOT NULL DEFAULT '',
  es_ES TEXT NOT NULL DEFAULT '',
  es_GT TEXT NOT NULL DEFAULT '',
  es_HN TEXT NOT NULL DEFAULT '',
  es_MX TEXT NOT NULL DEFAULT '',
  es_NI TEXT NOT NULL DEFAULT '',
  es_PA TEXT NOT NULL DEFAULT '',
  es_PE TEXT NOT NULL DEFAULT '',
  es_PR TEXT NOT NULL DEFAULT '',
  es_PY TEXT NOT NULL DEFAULT '',
  es_SV TEXT NOT NULL DEFAULT '',
  es_UY TEXT NOT NULL DEFAULT '',
  es_VE TEXT NOT NULL DEFAULT '',
  et_EE TEXT NOT NULL DEFAULT '',
  fa_IR TEXT NOT NULL DEFAULT '',
  fi_FI TEXT NOT NULL DEFAULT '',
  fr_BE TEXT NOT NULL DEFAULT '',
  fr_CA TEXT NOT NULL DEFAULT '',
  fr_CH TEXT NOT NULL DEFAULT '',
  fr_fr TEXT NOT NULL DEFAULT '',
  gl_ES TEXT NOT NULL DEFAULT '',
  gu_IN TEXT NOT NULL DEFAULT '',
  he_IL TEXT NOT NULL DEFAULT '',
  hi_IN TEXT NOT NULL DEFAULT '',
  hr_HR TEXT NOT NULL DEFAULT '',
  hu_HU TEXT NOT NULL DEFAULT '',
  id_ID TEXT NOT NULL DEFAULT '',
  it_IT TEXT NOT NULL DEFAULT '',
  iu_CA TEXT NOT NULL DEFAULT '',
  ja_JP TEXT NOT NULL DEFAULT '',
  ko_KP TEXT NOT NULL DEFAULT '',
  ko_KR TEXT NOT NULL DEFAULT '',
  lt_LT TEXT NOT NULL DEFAULT '',
  lv_LV TEXT NOT NULL DEFAULT '',
  ml_IN TEXT NOT NULL DEFAULT '',
  mn_MN TEXT NOT NULL DEFAULT '',
  nb_NO TEXT NOT NULL DEFAULT '',
  nl_NL TEXT NOT NULL DEFAULT '',
  nl_BE TEXT NOT NULL DEFAULT '',
  oc_FR TEXT NOT NULL DEFAULT '',
  pl_PL TEXT NOT NULL DEFAULT '',
  pt_BR TEXT NOT NULL DEFAULT '',
  pt_PT TEXT NOT NULL DEFAULT '',
  ro_RO TEXT NOT NULL DEFAULT '',
  ru_RU TEXT NOT NULL DEFAULT '',
  si_LK TEXT NOT NULL DEFAULT '',
  sl_SI TEXT NOT NULL DEFAULT '',
  sk_SK TEXT NOT NULL DEFAULT '',
  sq_AL TEXT NOT NULL DEFAULT '',
  sr_RS TEXT NOT NULL DEFAULT '',
  sr_latin TEXT NOT NULL DEFAULT '',
  sv_SE TEXT NOT NULL DEFAULT '',
  te_IN TEXT NOT NULL DEFAULT '',
  tr_TR TEXT NOT NULL DEFAULT '',
  vi_VN TEXT NOT NULL DEFAULT '',
  uk_UA TEXT NOT NULL DEFAULT '',
  ur_PK TEXT NOT NULL DEFAULT '',
  zh_CN TEXT NOT NULL DEFAULT '',
  zh_HK TEXT NOT NULL DEFAULT '',
  zh_TW TEXT NOT NULL DEFAULT '',
  th_TH TEXT NOT NULL DEFAULT '',
  tlh_TLH TEXT NOT NULL DEFAULT '',
  is_active BOOLEAN NOT NULL DEFAULT TRUE,
  comment TEXT NOT NULL DEFAULT '',
  CONSTRAINT coreTranslation_id_pk PRIMARY KEY(id),
  CONSTRAINT coreTranslation_code_uk UNIQUE(code)
);

CREATE TABLE core_config (
  id SERIAL,
  create_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  k VARCHAR(128) NOT NULL,
  v VARCHAR(128) NOT NULL,
  is_active BOOLEAN NOT NULL DEFAULT TRUE,
  comment TEXT NOT NULL DEFAULT '',
  CONSTRAINT coreConfig_id_pk PRIMARY KEY(id),
  CONSTRAINT coreConfig_k_uk UNIQUE(k)
);


--FIX bug core_feature with core_translation for menu and using models and views
CREATE TABLE core_feature_translation (
  id SERIAL,
  create_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  code VARCHAR(128) NOT NULL,
  source TEXT NOT NULL,
  ab_RU TEXT NOT NULL DEFAULT '',
  am_ET TEXT NOT NULL DEFAULT '',
  ar_SY TEXT NOT NULL DEFAULT '',
  bg_BG TEXT NOT NULL DEFAULT '',
  bs_BS TEXT NOT NULL DEFAULT '',
  ca_ES TEXT NOT NULL DEFAULT '',
  cs_CZ TEXT NOT NULL DEFAULT '',
  da_DK TEXT NOT NULL DEFAULT '',
  de_DE TEXT NOT NULL DEFAULT '',
  el_GR TEXT NOT NULL DEFAULT '',
  en_CA TEXT NOT NULL DEFAULT '',
  en_gb TEXT NOT NULL DEFAULT '',
  en_US TEXT NOT NULL DEFAULT '',
  es_AR TEXT NOT NULL DEFAULT '',
  es_BO TEXT NOT NULL DEFAULT '',
  es_CL TEXT NOT NULL DEFAULT '',
  es_CO TEXT NOT NULL DEFAULT '',
  es_CR TEXT NOT NULL DEFAULT '',
  es_DO TEXT NOT NULL DEFAULT '',
  es_EC TEXT NOT NULL DEFAULT '',
  es_ES TEXT NOT NULL DEFAULT '',
  es_GT TEXT NOT NULL DEFAULT '',
  es_HN TEXT NOT NULL DEFAULT '',
  es_MX TEXT NOT NULL DEFAULT '',
  es_NI TEXT NOT NULL DEFAULT '',
  es_PA TEXT NOT NULL DEFAULT '',
  es_PE TEXT NOT NULL DEFAULT '',
  es_PR TEXT NOT NULL DEFAULT '',
  es_PY TEXT NOT NULL DEFAULT '',
  es_SV TEXT NOT NULL DEFAULT '',
  es_UY TEXT NOT NULL DEFAULT '',
  es_VE TEXT NOT NULL DEFAULT '',
  et_EE TEXT NOT NULL DEFAULT '',
  fa_IR TEXT NOT NULL DEFAULT '',
  fi_FI TEXT NOT NULL DEFAULT '',
  fr_BE TEXT NOT NULL DEFAULT '',
  fr_CA TEXT NOT NULL DEFAULT '',
  fr_CH TEXT NOT NULL DEFAULT '',
  fr_fr TEXT NOT NULL DEFAULT '',
  gl_ES TEXT NOT NULL DEFAULT '',
  gu_IN TEXT NOT NULL DEFAULT '',
  he_IL TEXT NOT NULL DEFAULT '',
  hi_IN TEXT NOT NULL DEFAULT '',
  hr_HR TEXT NOT NULL DEFAULT '',
  hu_HU TEXT NOT NULL DEFAULT '',
  id_ID TEXT NOT NULL DEFAULT '',
  it_IT TEXT NOT NULL DEFAULT '',
  iu_CA TEXT NOT NULL DEFAULT '',
  ja_JP TEXT NOT NULL DEFAULT '',
  ko_KP TEXT NOT NULL DEFAULT '',
  ko_KR TEXT NOT NULL DEFAULT '',
  lt_LT TEXT NOT NULL DEFAULT '',
  lv_LV TEXT NOT NULL DEFAULT '',
  ml_IN TEXT NOT NULL DEFAULT '',
  mn_MN TEXT NOT NULL DEFAULT '',
  nb_NO TEXT NOT NULL DEFAULT '',
  nl_NL TEXT NOT NULL DEFAULT '',
  nl_BE TEXT NOT NULL DEFAULT '',
  oc_FR TEXT NOT NULL DEFAULT '',
  pl_PL TEXT NOT NULL DEFAULT '',
  pt_BR TEXT NOT NULL DEFAULT '',
  pt_PT TEXT NOT NULL DEFAULT '',
  ro_RO TEXT NOT NULL DEFAULT '',
  ru_RU TEXT NOT NULL DEFAULT '',
  si_LK TEXT NOT NULL DEFAULT '',
  sl_SI TEXT NOT NULL DEFAULT '',
  sk_SK TEXT NOT NULL DEFAULT '',
  sq_AL TEXT NOT NULL DEFAULT '',
  sr_RS TEXT NOT NULL DEFAULT '',
  sr_latin TEXT NOT NULL DEFAULT '',
  sv_SE TEXT NOT NULL DEFAULT '',
  te_IN TEXT NOT NULL DEFAULT '',
  tr_TR TEXT NOT NULL DEFAULT '',
  vi_VN TEXT NOT NULL DEFAULT '',
  uk_UA TEXT NOT NULL DEFAULT '',
  ur_PK TEXT NOT NULL DEFAULT '',
  zh_CN TEXT NOT NULL DEFAULT '',
  zh_HK TEXT NOT NULL DEFAULT '',
  zh_TW TEXT NOT NULL DEFAULT '',
  th_TH TEXT NOT NULL DEFAULT '',
  tlh_TLH TEXT NOT NULL DEFAULT '',
  is_active BOOLEAN NOT NULL DEFAULT TRUE,
  comment TEXT NOT NULL DEFAULT '',
  CONSTRAINT coreFeatureTranslation_id_pk PRIMARY KEY(id),
  CONSTRAINT coreFeatureTranslation_code_uk UNIQUE(code)
);

CREATE TABLE core_feature (
  id SERIAL,
  create_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  is_parent boolean NOT NULL DEFAULT FALSE,
  parent_id INTEGER,
  model VARCHAR(250) NOT NULL,
  code VARCHAR(64) NOT NULL,
  url_feature_translation_id INTEGER,
  label_feature_translation_id INTEGER,
  menu_icon VARCHAR(128),
  is_menu_display BOOLEAN NOT NULL DEFAULT FALSE,
  is_menu_backend BOOLEAN NOT NULL DEFAULT FALSE,
  is_available_for_guest BOOLEAN NOT NULL DEFAULT FALSE,
  is_user_feature BOOLEAN DEFAULT FALSE,
  is_admin_feature BOOLEAN DEFAULT FALSE,
  is_active BOOLEAN NOT NULL DEFAULT TRUE,
  priority INTEGER NOT NULL DEFAULT 100,
  CONSTRAINT coreFeatures_id_pk PRIMARY KEY(id),
  CONSTRAINT coreFeatures_parentId_fk FOREIGN KEY(parent_id) REFERENCES core_feature(id),
  CONSTRAINT coreFeature_urlFeatureTranslationId_fk FOREIGN KEY(url_feature_translation_id) REFERENCES core_feature_translation(id),
  CONSTRAINT coreFeature_labelFeatureTranslationId_fk FOREIGN KEY(label_feature_translation_id) REFERENCES core_feature_translation(id),
  CONSTRAINT coreFeatures_code_uk UNIQUE(code)
);






/* OFFICIAL DATA */
INSERT INTO core_theme(code, name, is_prod_available) VALUES('default', 'Default', TRUE);

INSERT INTO core_currency(code, name, symbol, rounding, priority) VALUES ('usd', 'USD', '$', '0.01', 3);
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('vef', 'VEF', 'Bs.F', '0.0001');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('cad', 'CAD', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding, priority) VALUES ('chf', 'CHF', 'CHF', '0.01', 1);
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('brl', 'BRL', 'R$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('cny', 'CNY', '¥', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('cop', 'COP', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('czk', 'CZK', 'Kč', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('dkk', 'DKK', 'kr', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('huf', 'HUF', 'Ft', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('idr', 'IDR', 'Rp', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('lvl', 'LVL', 'Ls', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('nok', 'NOK', 'kr', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('xpf', 'XPF', 'XPF', '1.00');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('pab', 'PAB', 'B/.', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('pln', 'PLN', 'zł', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('sek', 'SEK', 'kr', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('ars', 'ARS', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('inr', 'INR', '₹', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('aud', 'AUD', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('uah', 'UAH', '₴', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('vnd', 'VND', '₫', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('hkd', 'HKD', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('jpy', 'JPY', '¥', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('bgn', 'BGN', 'лв', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('ltl', 'LTL', 'Lt', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('ron', 'RON', 'lei', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('hrk', 'HRK', 'kn', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('rub', 'RUB', 'руб', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('try', 'TRY', 'TL', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('krw', 'KRW', '₩', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('mxn', 'MXN', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('myr', 'MYR', 'RM', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('nzd', 'NZD', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('php', 'PHP', 'Php', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('sgd', 'SGD', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('zar', 'ZAR', 'R', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('crc', 'CRC', '¢', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('mur', 'MUR', 'Rs', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('xof', 'XOF', 'CFA', '1');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('xaf', 'XAF', 'FCFA', '1');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('ugx', 'UGX', 'USh', '1');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('hnl', 'HNL', 'L', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('clp', 'CLP', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('uyu', 'UYU', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('afn', 'AFN', 'Afs', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('aoa', 'AOA', 'Kz', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('xcd', 'XCD', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('amd', 'AMD', 'դր..', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('awg', 'AWG', 'Afl.', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('azn', 'AZN', 'm', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('bsd', 'BSD', 'B$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('bhd', 'BHD', 'BD', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('bdt', 'BDT', '৳', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('bbd', 'BBD', 'Bds$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('byr', 'BYR', 'BR', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('bzd', 'BZD', 'BZ$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('bmd', 'BMD', 'BD$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('btn', 'BTN', 'Nu.', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('bob', 'BOB', 'Bs.', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('bam', 'BAM', 'KM', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('bwp', 'BWP', 'P', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('bif', 'BIF', 'FBu', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('khr', 'KHR', '៛', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('kyd', 'KYD', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('kmf', 'KMF', 'CF', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('cdf', 'CDF', 'Fr', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('cup', 'CUP', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('ang', 'ANG', 'ƒ', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('cyp', 'CYP', '£', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('djf', 'DJF', 'Fdj', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('dop', 'DOP', 'RD$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('tpe', 'TPE', 'RD$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('ecs', 'ECS', 'S/.', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('egp', 'EGP', 'E£', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('svc', 'SVC', '¢', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('ern', 'ERN', 'Nfk', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('eek', 'EEK', 'kr', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('etb', 'ETB', 'Br', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('fkp', 'FKP', '£', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('fjd', 'FJD', 'FJ$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('gel', 'GEL', 'ლ', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('gip', 'GIP', '£', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('qtq', 'QTQ', 'Q', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('gnf', 'GNF', 'FG', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('gwp', 'GWP', 'FG', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('gyd', 'GYD', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('htg', 'HTG', 'G', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('isk', 'ISK', 'kr', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('irr', 'IRR', '﷼', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('iqd', 'IQD', 'ع.د', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('ils', 'ILS', '₪', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('jmd', 'JMD', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('jod', 'JOD', ' د.ا ', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('kzt', 'KZT', 'лв', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('kes', 'KES', 'KSh', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('kwd', 'KWD', ' د.ك ', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('kgs', 'KGS', 'лв', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('lak', 'LAK', '₭', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('lbp', 'LBP', 'ل.ل', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('lsl', 'LSL', 'L', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('lrd', 'LRD', 'L$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('lyd', 'LYD', ' ل.د ', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('mop', 'MOP', 'MOP$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('mkd', 'MKD', 'ден', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('mga', 'MGA', 'Ar', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('mwk', 'MWK', 'MK', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('mvr', 'MVR', '.ރ', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('mro', 'MRO', 'UM', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('mdl', 'MDL', 'L', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('mnt', 'MNT', '₮', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('mad', 'MAD', ' د.م. ', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('bnd', 'BND', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('dzd', 'DZD', 'DZ', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('ghs', 'GHS', 'GHÂ¢', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('gmd', 'GMD', 'D', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('zrz', 'ZRZ', 'Ƶ', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('mzn', 'MZN', 'MT', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('mmk', 'MMK', 'K', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('nad', 'NAD', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('npr', 'NPR', '₨', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('all', 'ALL', 'L', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('nio', 'NIO', 'C$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('ngn', 'NGN', '₦', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('kpw', 'KPW', '₩', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('zwd', 'ZWD', 'Z$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('zmk', 'ZMK', 'ZK', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('yer', 'YER', '﷼', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('vub', 'VUB', 'Bs', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding, priority) VALUES ('eur', 'EUR', '€', '0.01', 2);
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('vuv', 'VUV', 'VT', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('uzs', 'UZS', 'лв', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('uyp', 'UYP', '$U', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('aed', 'AED', 'د.إ', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('uag', 'UAG', '₴', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('tmm', 'TMM', 'm', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('trl', 'TRL', 'TL', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('tnd', 'TND', 'DT', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('ttd', 'TTD', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('top', 'TOP', 'T$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('thb', 'THB', '฿', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('tzs', 'TZS', 'x/y', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('tjr', 'TJR', 'x/y', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('twd', 'TWD', 'NT$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('syp', 'SYP', '£', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('szl', 'SZL', 'E', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('srg', 'SRG', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('sdd', 'SDD', '£Sd', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('lkr', 'LKR', 'Rs', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('ssp', 'SSP', '£', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('gbp', 'GBP', '£', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('sod', 'SOD', 'Sh.', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('sbd', 'SBD', 'SI$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('sll', 'SLL', 'Le', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('scr', 'SCR', 'SR', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('rsd', 'RSD', 'din.', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('sar', 'SAR', 'SR', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('std', 'STD', 'Db', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('itl', 'ITL', '₤', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('wst', 'WST', 'WS$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('shp', 'SHP', '£', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('rwf', 'RWF', 'RF', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('rur', 'RUR', 'R', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('rol', 'ROL', 'L', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('qar', 'QAR', 'QR', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('plz', 'PLZ', 'zł', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('pen', 'PEN', 'S/.', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('pyg', 'PYG', '₲', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('pgk', 'PGK', 'K', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('pkr', 'PKR', 'Rs.', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('omr', 'OMR', 'ر.ع.', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('cve', 'CVE', '$', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('skk', 'SKK', 'Sk', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('sit', 'SIT', 'Sk', '0.01');
INSERT INTO core_currency(code, name, symbol, rounding) VALUES ('yum', 'YUM', 'дин.', '0.01');
UPDATE core_currency SET decimal_precision=4 WHERE rounding=0.0001;
UPDATE core_currency SET decimal_precision=0 WHERE rounding=1.0;


INSERT INTO core_lang(code, name) VALUES ('ab_ru', 'Abkhazian / аҧсуа');
INSERT INTO core_lang(code, name) VALUES ('am_et', 'Amharic / አምሃርኛ');
INSERT INTO core_lang(code, name) VALUES ('ar_sy', 'Arabic / الْعَرَبيّة');
INSERT INTO core_lang(code, name) VALUES ('bg_bg', 'Bulgarian / български език');
INSERT INTO core_lang(code, name) VALUES ('bs_bs', 'Bosnian / bosanski jezik');
INSERT INTO core_lang(code, name) VALUES ('ca_es', 'Catalan / Català');
INSERT INTO core_lang(code, name) VALUES ('cs_cz', 'Czech / Čeština');
INSERT INTO core_lang(code, name) VALUES ('da_dk', 'Danish / Dansk');
INSERT INTO core_lang(code, name) VALUES ('de_de', 'German / Deutsch');
INSERT INTO core_lang(code, name) VALUES ('el_gr', 'Greek / Ελληνικά');
INSERT INTO core_lang(code, name) VALUES ('en_ca', 'English (CA)');
INSERT INTO core_lang(code, name, is_active) VALUES ('en_gb', 'English (UK)', TRUE);
INSERT INTO core_lang(code, name) VALUES ('en_us', 'English (US)');
INSERT INTO core_lang(code, name) VALUES ('es_ar', 'Spanish (AR) / Español (AR)');
INSERT INTO core_lang(code, name) VALUES ('es_bo', 'Spanish (BO) / Español (BO)');
INSERT INTO core_lang(code, name) VALUES ('es_cl', 'Spanish (CL) / Español (CL)');
INSERT INTO core_lang(code, name) VALUES ('es_co', 'Spanish (CO) / Español (CO)');
INSERT INTO core_lang(code, name) VALUES ('es_cr', 'Spanish (CR) / Español (CR)');
INSERT INTO core_lang(code, name) VALUES ('es_do', 'Spanish (DO) / Español (DO)');
INSERT INTO core_lang(code, name) VALUES ('es_ec', 'Spanish (EC) / Español (EC)');
INSERT INTO core_lang(code, name) VALUES ('es_es', 'Español');
INSERT INTO core_lang(code, name) VALUES ('es_gt', 'Spanish (GT) / Español (GT)');
INSERT INTO core_lang(code, name) VALUES ('es_hn', 'Spanish (HN) / Español (HN)');
INSERT INTO core_lang(code, name) VALUES ('es_mx', 'Spanish (MX) / Español (MX)');
INSERT INTO core_lang(code, name) VALUES ('es_ni', 'Spanish (NI) / Español (NI)');
INSERT INTO core_lang(code, name) VALUES ('es_pa', 'Spanish (PA) / Español (PA)');
INSERT INTO core_lang(code, name) VALUES ('es_pe', 'Spanish (PE) / Español (PE)');
INSERT INTO core_lang(code, name) VALUES ('es_pr', 'Spanish (PR) / Español (PR)');
INSERT INTO core_lang(code, name) VALUES ('es_py', 'Spanish (PY) / Español (PY)');
INSERT INTO core_lang(code, name) VALUES ('es_sv', 'Spanish (SV) / Español (SV)');
INSERT INTO core_lang(code, name) VALUES ('es_uy', 'Spanish (UY) / Español (UY)');
INSERT INTO core_lang(code, name) VALUES ('es_ve', 'Spanish (VE) / Español (VE)');
INSERT INTO core_lang(code, name) VALUES ('et_ee', 'Estonian / Eesti keel');
INSERT INTO core_lang(code, name) VALUES ('fa_ir', 'Persian / افارس');
INSERT INTO core_lang(code, name) VALUES ('fi_fi', 'Finnish / Suomi');
INSERT INTO core_lang(code, name) VALUES ('fr_be', 'French (BE) / Français (BE)');
INSERT INTO core_lang(code, name) VALUES ('fr_ca', 'French (CA) / Français (CA)');
INSERT INTO core_lang(code, name) VALUES ('fr_ch', 'French (CH) / Français (CH)');
INSERT INTO core_lang(code, name, is_active) VALUES ('fr_fr', 'Français', TRUE);
INSERT INTO core_lang(code, name) VALUES ('gl_es', 'Galician / Galego');
INSERT INTO core_lang(code, name) VALUES ('gu_in', 'Gujarati / ગુજરાતી');
INSERT INTO core_lang(code, name) VALUES ('he_il', 'Hebrew / עִבְרִי');
INSERT INTO core_lang(code, name) VALUES ('hi_in', 'Hindi / हिंदी');
INSERT INTO core_lang(code, name) VALUES ('hr_hr', 'Croatian / hrvatski jezik');
INSERT INTO core_lang(code, name) VALUES ('hu_hu', 'Hungarian / Magyar');
INSERT INTO core_lang(code, name) VALUES ('id_id', 'Indonesian / Bahasa Indonesia');
INSERT INTO core_lang(code, name) VALUES ('it_it', 'Italian / Italiano');
INSERT INTO core_lang(code, name) VALUES ('iu_ca', 'Inuktitut / ᐃᓄᒃᑎᑐᑦ');
INSERT INTO core_lang(code, name) VALUES ('ja_jp', 'Japanese / 日本語');
INSERT INTO core_lang(code, name) VALUES ('ko_kp', 'Korean (KP) / 한국어 (KP)');
INSERT INTO core_lang(code, name) VALUES ('ko_kr', '한국어 (KR)');
INSERT INTO core_lang(code, name) VALUES ('lt_lt', 'Lithuanian / Lietuvių kalba');
INSERT INTO core_lang(code, name) VALUES ('lv_lv', 'Latvian / latviešu valoda');
INSERT INTO core_lang(code, name) VALUES ('ml_in', 'Malayalam / മലയാളം');
INSERT INTO core_lang(code, name) VALUES ('mn_mn', 'Mongolian / монгол');
INSERT INTO core_lang(code, name) VALUES ('nb_no', 'Norwegian Bokmål / Norsk bokmål');
INSERT INTO core_lang(code, name) VALUES ('nl_nl', 'Dutch / Nederlands');
INSERT INTO core_lang(code, name) VALUES ('nl_be', 'Flemish (BE) / Vlaams (BE)');
INSERT INTO core_lang(code, name) VALUES ('oc_fr', 'Occitan (FR, post 1500) / Occitan');
INSERT INTO core_lang(code, name) VALUES ('pl_pl', 'Polish / Język polski');
INSERT INTO core_lang(code, name) VALUES ('pt_br', 'Portuguese (BR) / Português (BR)');
INSERT INTO core_lang(code, name) VALUES ('pt_pt', 'Portuguese / Português');
INSERT INTO core_lang(code, name) VALUES ('ro_ro', 'Romanian / română');
INSERT INTO core_lang(code, name) VALUES ('ru_ru', 'Russian / русский язык');
INSERT INTO core_lang(code, name) VALUES ('si_lk', 'Sinhalese / සිංහල');
INSERT INTO core_lang(code, name) VALUES ('sl_si', 'Slovenian / slovenščina');
INSERT INTO core_lang(code, name) VALUES ('sk_sk', 'Slovak / Slovenský jazyk');
INSERT INTO core_lang(code, name) VALUES ('sq_al', 'Albanian / Shqip');
INSERT INTO core_lang(code, name) VALUES ('sr_rs', 'Serbian (Cyrillic) / српски');
INSERT INTO core_lang(code, name) VALUES ('sr_latin', 'Serbian (Latin) / srpski');
INSERT INTO core_lang(code, name) VALUES ('sv_se', 'Swedish / svenska');
INSERT INTO core_lang(code, name) VALUES ('te_in', 'Telugu / తెలుగు');
INSERT INTO core_lang(code, name) VALUES ('tr_tr', 'Turkish / Türkçe');
INSERT INTO core_lang(code, name) VALUES ('vi_vn', 'Vietnamese / Tiếng Việt');
INSERT INTO core_lang(code, name) VALUES ('uk_ua', 'Ukrainian / українська');
INSERT INTO core_lang(code, name) VALUES ('ur_pk', 'Urdu / اردو');
INSERT INTO core_lang(code, name) VALUES ('zh_cn', 'Chinese (CN) / 简体中文');
INSERT INTO core_lang(code, name) VALUES ('zh_hk', 'Chinese (HK)');
INSERT INTO core_lang(code, name) VALUES ('zh_tw', 'Chinese (TW) / 正體字');
INSERT INTO core_lang(code, name) VALUES ('th_th', 'Thai / ภาษาไทย');
INSERT INTO core_lang(code, name) VALUES ('tlh_tlh', 'Klingon');

INSERT INTO core_country(code, name, core_currency_id) VALUES ('ad', 'Andorra, Principality of', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ae', 'United Arab Emirates', (SELECT id FROM core_currency WHERE code='aed' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('af', 'Afghanistan, Islamic State of', (SELECT id FROM core_currency WHERE code='afn' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ag', 'Antigua and Barbuda', (SELECT id FROM core_currency WHERE code='xcd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ai', 'Anguilla', (SELECT id FROM core_currency WHERE code='xcd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('al', 'Albania', (SELECT id FROM core_currency WHERE code='all' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('am', 'Armenia', (SELECT id FROM core_currency WHERE code='amd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('an', 'Netherlands Antilles', (SELECT id FROM core_currency WHERE code='nok' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ao', 'Angola', (SELECT id FROM core_currency WHERE code='aoa' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('aq', 'Antarctica', (SELECT id FROM core_currency WHERE code='xcd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ar', 'Argentina', (SELECT id FROM core_currency WHERE code='ars' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('as', 'American Samoa', (SELECT id FROM core_currency WHERE code='usd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('at', 'Austria', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('au', 'Australia', (SELECT id FROM core_currency WHERE code='aud' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('aw', 'Aruba', (SELECT id FROM core_currency WHERE code='awg' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ax', 'Åland Islands', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('az', 'Azerbaijan', (SELECT id FROM core_currency WHERE code='azn' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ba', 'Bosnia-Herzegovina', (SELECT id FROM core_currency WHERE code='bam' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bb', 'Barbados', (SELECT id FROM core_currency WHERE code='bbd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bd', 'Bangladesh', (SELECT id FROM core_currency WHERE code='bdt' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('be', 'Belgium', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bf', 'Burkina Faso', (SELECT id FROM core_currency WHERE code='xof' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bg', 'Bulgaria', (SELECT id FROM core_currency WHERE code='bgn' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bh', 'Bahrain', (SELECT id FROM core_currency WHERE code='bhd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bi', 'Burundi', (SELECT id FROM core_currency WHERE code='bif' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bj', 'Benin', (SELECT id FROM core_currency WHERE code='xof' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bl', 'Saint Barthélémy', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bm', 'Bermuda', (SELECT id FROM core_currency WHERE code='bmd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bn', 'Brunei Darussalam', (SELECT id FROM core_currency WHERE code='bnd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bo', 'Bolivia', (SELECT id FROM core_currency WHERE code='bob' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bq', 'Bonaire, Sint Eustatius and Saba', (SELECT id FROM core_currency WHERE code='usd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('br', 'Brazil', (SELECT id FROM core_currency WHERE code='brl' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bs', 'Bahamas', (SELECT id FROM core_currency WHERE code='bsd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bt', 'Bhutan', (SELECT id FROM core_currency WHERE code='btn' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bv', 'Bouvet Island', (SELECT id FROM core_currency WHERE code='nok' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bw', 'Botswana', (SELECT id FROM core_currency WHERE code='bwp' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('by', 'Belarus', (SELECT id FROM core_currency WHERE code='byr' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('bz', 'Belize', (SELECT id FROM core_currency WHERE code='bzd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ca', 'Canada', (SELECT id FROM core_currency WHERE code='cad' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('cc', 'Cocos (Keeling) Islands', (SELECT id FROM core_currency WHERE code='aud' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('cf', 'Central African Republic', (SELECT id FROM core_currency WHERE code='xaf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('cd', 'Congo, Democratic Republic of the', (SELECT id FROM core_currency WHERE code='cdf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('cg', 'Congo', (SELECT id FROM core_currency WHERE code='xaf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id, priority) VALUES ('ch', 'Switzerland', (SELECT id FROM core_currency WHERE code='chf' LIMIT 1), 1);
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ci', 'Ivory Coast (Cote D''Ivoire)', (SELECT id FROM core_currency WHERE code='xof' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ck', 'Cook Islands', (SELECT id FROM core_currency WHERE code='nzd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('cl', 'Chile', (SELECT id FROM core_currency WHERE code='aud' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('cm', 'Cameroon', (SELECT id FROM core_currency WHERE code='xaf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('cn', 'China', (SELECT id FROM core_currency WHERE code='cny' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('co', 'Colombia', (SELECT id FROM core_currency WHERE code='cop' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('cr', 'Costa Rica', (SELECT id FROM core_currency WHERE code='crc' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('cu', 'Cuba', (SELECT id FROM core_currency WHERE code='cup' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('cv', 'Cape Verde', (SELECT id FROM core_currency WHERE code='cve' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('cw', 'Curaçao', (SELECT id FROM core_currency WHERE code='ang' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('cx', 'Christmas Island', (SELECT id FROM core_currency WHERE code='aud' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('cy', 'Cyprus', (SELECT id FROM core_currency WHERE code='cyp' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('cz', 'Czech Republic', (SELECT id FROM core_currency WHERE code='czk' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id, priority) VALUES ('de', 'Germany', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1), 3);
INSERT INTO core_country(code, name, core_currency_id) VALUES ('dj', 'Djibouti', (SELECT id FROM core_currency WHERE code='djf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('dk', 'Denmark', (SELECT id FROM core_currency WHERE code='dkk' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('dm', 'Dominica', (SELECT id FROM core_currency WHERE code='xcd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('do', 'Dominican Republic', (SELECT id FROM core_currency WHERE code='dop' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('dz', 'Algeria', (SELECT id FROM core_currency WHERE code='dzd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ec', 'Ecuador', (SELECT id FROM core_currency WHERE code='ecs' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ee', 'Estonia', (SELECT id FROM core_currency WHERE code='eek' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('eg', 'Egypt', (SELECT id FROM core_currency WHERE code='egp' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('eh', 'Western Sahara', (SELECT id FROM core_currency WHERE code='mad' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('er', 'Eritrea', (SELECT id FROM core_currency WHERE code='ern' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('es', 'Spain', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('et', 'Ethiopia', (SELECT id FROM core_currency WHERE code='etb' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('fi', 'Finland', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('fj', 'Fiji', (SELECT id FROM core_currency WHERE code='fjd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('fk', 'Falkland Islands', (SELECT id FROM core_currency WHERE code='fkp' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('fm', 'Micronesia', (SELECT id FROM core_currency WHERE code='usd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('fo', 'Faroe Islands', (SELECT id FROM core_currency WHERE code='dkk' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id, priority) VALUES ('fr', 'France', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1), 2);
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ga', 'Gabon', (SELECT id FROM core_currency WHERE code='xaf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gd', 'Grenada', (SELECT id FROM core_currency WHERE code='xcd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ge', 'Georgia', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gf', 'French Guyana', (SELECT id FROM core_currency WHERE code='gel' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gh', 'Ghana', (SELECT id FROM core_currency WHERE code='ghs' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gi', 'Gibraltar', (SELECT id FROM core_currency WHERE code='gip' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gg', 'Guernsey', (SELECT id FROM core_currency WHERE code='gbp' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gl', 'Greenland', (SELECT id FROM core_currency WHERE code='dkk' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gm', 'Gambia', (SELECT id FROM core_currency WHERE code='gmd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gn', 'Guinea', (SELECT id FROM core_currency WHERE code='gnf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gp', 'Guadeloupe (French)', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gq', 'Equatorial Guinea', (SELECT id FROM core_currency WHERE code='xaf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gr', 'Greece', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gs', 'South Georgia and the South Sandwich Islands', (SELECT id FROM core_currency WHERE code='gbp' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gt', 'Guatemala', (SELECT id FROM core_currency WHERE code='qtq' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gu', 'Guam (USA)', (SELECT id FROM core_currency WHERE code='usd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gw', 'Guinea Bissau', (SELECT id FROM core_currency WHERE code='gwp' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('gy', 'Guyana', (SELECT id FROM core_currency WHERE code='gyd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('hk', 'Hong Kong', (SELECT id FROM core_currency WHERE code='hkd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('hm', 'Heard and McDonald Islands', (SELECT id FROM core_currency WHERE code='aud' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('hn', 'Honduras', (SELECT id FROM core_currency WHERE code='hnl' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('hr', 'Croatia', (SELECT id FROM core_currency WHERE code='hrk' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ht', 'Haiti', (SELECT id FROM core_currency WHERE code='htg' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('hu', 'Hungary', (SELECT id FROM core_currency WHERE code='huf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('id', 'Indonesia', (SELECT id FROM core_currency WHERE code='idr' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ie', 'Ireland', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('il', 'Israel', (SELECT id FROM core_currency WHERE code='ils' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('im', 'Isle of Man', (SELECT id FROM core_currency WHERE code='gbp' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('in', 'India', (SELECT id FROM core_currency WHERE code='inr' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('io', 'British Indian Ocean Territory', (SELECT id FROM core_currency WHERE code='usd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('iq', 'Iraq', (SELECT id FROM core_currency WHERE code='iqd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ir', 'Iran', (SELECT id FROM core_currency WHERE code='irr' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('is', 'Iceland', (SELECT id FROM core_currency WHERE code='isk' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('it', 'Italy', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('je', 'Jersey', (SELECT id FROM core_currency WHERE code='gbp' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('jm', 'Jamaica', (SELECT id FROM core_currency WHERE code='jmd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('jo', 'Jordan', (SELECT id FROM core_currency WHERE code='jod' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('jp', 'Japan', (SELECT id FROM core_currency WHERE code='jpy' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ke', 'Kenya', (SELECT id FROM core_currency WHERE code='kes' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('kg', 'Kyrgyz Republic (Kyrgyzstan)', (SELECT id FROM core_currency WHERE code='kgs' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('kh', 'Cambodia, Kingdom of', (SELECT id FROM core_currency WHERE code='khr' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ki', 'Kiribati', (SELECT id FROM core_currency WHERE code='aud' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('km', 'Comoros', (SELECT id FROM core_currency WHERE code='kmf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('kn', 'Saint Kitts & Nevis Anguilla', (SELECT id FROM core_currency WHERE code='xcd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('kp', 'North Korea', (SELECT id FROM core_currency WHERE code='kpw' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('kr', 'South Korea', (SELECT id FROM core_currency WHERE code='krw' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('kw', 'Kuwait', (SELECT id FROM core_currency WHERE code='kwd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ky', 'Cayman Islands', (SELECT id FROM core_currency WHERE code='kyd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('kz', 'Kazakhstan', (SELECT id FROM core_currency WHERE code='kzt' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('la', 'Laos', (SELECT id FROM core_currency WHERE code='lak' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('lb', 'Lebanon', (SELECT id FROM core_currency WHERE code='lbp' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('lc', 'Saint Lucia', (SELECT id FROM core_currency WHERE code='xcd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('li', 'Liechtenstein', (SELECT id FROM core_currency WHERE code='chf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('lk', 'Sri Lanka', (SELECT id FROM core_currency WHERE code='lkr' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('lr', 'Liberia', (SELECT id FROM core_currency WHERE code='lrd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ls', 'Lesotho', (SELECT id FROM core_currency WHERE code='lsl' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('lt', 'Lithuania', (SELECT id FROM core_currency WHERE code='ltl' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('lu', 'Luxembourg', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('lv', 'Latvia', (SELECT id FROM core_currency WHERE code='lvl' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ly', 'Libya', (SELECT id FROM core_currency WHERE code='lyd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ma', 'Morocco', (SELECT id FROM core_currency WHERE code='mad' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mc', 'Monaco', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('md', 'Moldavia', (SELECT id FROM core_currency WHERE code='mdl' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('me', 'Montenegro', (SELECT id FROM core_currency WHERE code='lyd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mf', 'Saint Martin (French part)', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mg', 'Madagascar', (SELECT id FROM core_currency WHERE code='mga' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mh', 'Marshall Islands', (SELECT id FROM core_currency WHERE code='usd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mk', 'Macedonia, the former Yugoslav Republic of', (SELECT id FROM core_currency WHERE code='mkd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ml', 'Mali', (SELECT id FROM core_currency WHERE code='xof' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mm', 'Myanmar', (SELECT id FROM core_currency WHERE code='mmk' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mn', 'Mongolia', (SELECT id FROM core_currency WHERE code='mnt' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mo', 'Macau', (SELECT id FROM core_currency WHERE code='mop' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mp', 'Northern Mariana Islands', (SELECT id FROM core_currency WHERE code='usd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mq', 'Martinique (French)', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mr', 'Mauritania', (SELECT id FROM core_currency WHERE code='mro' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ms', 'Montserrat', (SELECT id FROM core_currency WHERE code='xcd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mt', 'Malta', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mu', 'Mauritius', (SELECT id FROM core_currency WHERE code='mur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mv', 'Maldives', (SELECT id FROM core_currency WHERE code='mvr' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mw', 'Malawi', (SELECT id FROM core_currency WHERE code='mwk' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mx', 'Mexico', (SELECT id FROM core_currency WHERE code='mxn' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('my', 'Malaysia', (SELECT id FROM core_currency WHERE code='mxn' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('mz', 'Mozambique', (SELECT id FROM core_currency WHERE code='mzn' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('na', 'Namibia', (SELECT id FROM core_currency WHERE code='nad' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('nc', 'New Caledonia (French)', (SELECT id FROM core_currency WHERE code='xpf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ne', 'Niger', (SELECT id FROM core_currency WHERE code='xof' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('nf', 'Norfolk Island', (SELECT id FROM core_currency WHERE code='aud' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ng', 'Nigeria', (SELECT id FROM core_currency WHERE code='ngn' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ni', 'Nicaragua', (SELECT id FROM core_currency WHERE code='nio' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('nl', 'Netherlands', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('no', 'Norway', (SELECT id FROM core_currency WHERE code='nok' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('np', 'Nepal', (SELECT id FROM core_currency WHERE code='npr' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('nr', 'Nauru', (SELECT id FROM core_currency WHERE code='aud' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('nt', 'Neutral Zone', (SELECT id FROM core_currency WHERE code='iqd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('nu', 'Niue', (SELECT id FROM core_currency WHERE code='nzd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('nz', 'New Zealand', (SELECT id FROM core_currency WHERE code='nzd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('om', 'Oman', (SELECT id FROM core_currency WHERE code='omr' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('pa', 'Panama', (SELECT id FROM core_currency WHERE code='pab' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('pe', 'Peru', (SELECT id FROM core_currency WHERE code='pen' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('pf', 'Polynesia (French)', (SELECT id FROM core_currency WHERE code='xpf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('pg', 'Papua New Guinea', (SELECT id FROM core_currency WHERE code='pgk' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ph', 'Philippines', (SELECT id FROM core_currency WHERE code='php' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('pk', 'Pakistan', (SELECT id FROM core_currency WHERE code='pkr' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('pl', 'Poland', (SELECT id FROM core_currency WHERE code='plz' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('pm', 'Saint Pierre and Miquelon', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('pn', 'Pitcairn Island', (SELECT id FROM core_currency WHERE code='nzd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('pr', 'Puerto Rico', (SELECT id FROM core_currency WHERE code='usd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ps', 'Palestinian Territory, Occupied', (SELECT id FROM core_currency WHERE code='ils' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('pt', 'Portugal', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('pw', 'Palau', (SELECT id FROM core_currency WHERE code='usd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('py', 'Paraguay', (SELECT id FROM core_currency WHERE code='pyg' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('qa', 'Qatar', (SELECT id FROM core_currency WHERE code='qar' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('re', 'Reunion (French)', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ro', 'Romania', (SELECT id FROM core_currency WHERE code='rol' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('rs', 'Serbia', (SELECT id FROM core_currency WHERE code='rsd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id, priority) VALUES ('ru', 'Russian Federation', (SELECT id FROM core_currency WHERE code='rub' LIMIT 1), 100);
INSERT INTO core_country(code, name, core_currency_id) VALUES ('rw', 'Rwanda', (SELECT id FROM core_currency WHERE code='rwf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sa', 'Saudi Arabia', (SELECT id FROM core_currency WHERE code='sar' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sb', 'Solomon Islands', (SELECT id FROM core_currency WHERE code='sbd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sc', 'Seychelles', (SELECT id FROM core_currency WHERE code='scr' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sd', 'Sudan', (SELECT id FROM core_currency WHERE code='sdd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('se', 'Sweden', (SELECT id FROM core_currency WHERE code='sek' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sg', 'Singapore', (SELECT id FROM core_currency WHERE code='sgd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sh', 'Saint Helena', (SELECT id FROM core_currency WHERE code='shp' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('si', 'Slovenia', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sj', 'Svalbard and Jan Mayen Islands', (SELECT id FROM core_currency WHERE code='nok' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sk', 'Slovakia', (SELECT id FROM core_currency WHERE code='skk' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sl', 'Sierra Leone', (SELECT id FROM core_currency WHERE code='sll' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sm', 'San Marino', (SELECT id FROM core_currency WHERE code='itl' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sn', 'Senegal', (SELECT id FROM core_currency WHERE code='xof' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('so', 'Somalia', (SELECT id FROM core_currency WHERE code='sod' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sr', 'Suriname', (SELECT id FROM core_currency WHERE code='srg' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ss', 'South Sudan', (SELECT id FROM core_currency WHERE code='ssp' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('st', 'Saint Tome (Sao Tome) and Principe', (SELECT id FROM core_currency WHERE code='std' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sv', 'El Salvador', (SELECT id FROM core_currency WHERE code='svc' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sx', 'Sint Maarten (Dutch part)', (SELECT id FROM core_currency WHERE code='ang' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sy', 'Syria', (SELECT id FROM core_currency WHERE code='syp' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('sz', 'Swaziland', (SELECT id FROM core_currency WHERE code='szl' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('tc', 'Turks and Caicos Islands', (SELECT id FROM core_currency WHERE code='usd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('td', 'Chad', (SELECT id FROM core_currency WHERE code='xaf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('tf', 'French Southern Territories', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('tg', 'Togo', (SELECT id FROM core_currency WHERE code='xof' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('th', 'Thailand', (SELECT id FROM core_currency WHERE code='thb' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('tj', 'Tajikistan', (SELECT id FROM core_currency WHERE code='tjr' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('tk', 'Tokelau', (SELECT id FROM core_currency WHERE code='nzd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('tm', 'Turkmenistan', (SELECT id FROM core_currency WHERE code='tmm' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('tn', 'Tunisia', (SELECT id FROM core_currency WHERE code='tnd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('to', 'Tonga', (SELECT id FROM core_currency WHERE code='top' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('tp', 'East Timor', (SELECT id FROM core_currency WHERE code='tpe' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('tr', 'Turkey', (SELECT id FROM core_currency WHERE code='trl' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('tt', 'Trinidad and Tobago', (SELECT id FROM core_currency WHERE code='ttd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('tv', 'Tuvalu', (SELECT id FROM core_currency WHERE code='aud' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('tw', 'Taiwan', (SELECT id FROM core_currency WHERE code='twd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('tz', 'Tanzania', (SELECT id FROM core_currency WHERE code='tzs' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ua', 'Ukraine', (SELECT id FROM core_currency WHERE code='uag' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ug', 'Uganda', (SELECT id FROM core_currency WHERE code='ugx' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id, priority) VALUES ('gb', 'United Kingdom', (SELECT id FROM core_currency WHERE code='gbp' LIMIT 1), 4);
INSERT INTO core_country(code, name, core_currency_id) VALUES ('um', 'USA Minor Outlying Islands', (SELECT id FROM core_currency WHERE code='usd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('us', 'United States', (SELECT id FROM core_currency WHERE code='usd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('uy', 'Uruguay', (SELECT id FROM core_currency WHERE code='uyp' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('uz', 'Uzbekistan', (SELECT id FROM core_currency WHERE code='uzs' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('va', 'Holy See (Vatican City State)', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('vc', 'Saint Vincent & Grenadines', (SELECT id FROM core_currency WHERE code='xcd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ve', 'Venezuela', (SELECT id FROM core_currency WHERE code='vub' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('vg', 'Virgin Islands (British)', (SELECT id FROM core_currency WHERE code='usd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('vi', 'Virgin Islands (USA)', (SELECT id FROM core_currency WHERE code='usd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('vn', 'Vietnam', (SELECT id FROM core_currency WHERE code='vnd' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('vu', 'Vanuatu', (SELECT id FROM core_currency WHERE code='vuv' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('wf', 'Wallis and Futuna Islands', (SELECT id FROM core_currency WHERE code='xpf' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ws', 'Samoa', (SELECT id FROM core_currency WHERE code='wst' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('ye', 'Yemen', (SELECT id FROM core_currency WHERE code='yer' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('yt', 'Mayotte', (SELECT id FROM core_currency WHERE code='eur' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('yu', 'Yugoslavia', (SELECT id FROM core_currency WHERE code='yum' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('za', 'South Africa', (SELECT id FROM core_currency WHERE code='zar' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('zm', 'Zambia', (SELECT id FROM core_currency WHERE code='zmk' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('zr', 'Zaire', (SELECT id FROM core_currency WHERE code='zrz' LIMIT 1) );
INSERT INTO core_country(code, name, core_currency_id) VALUES ('zw', 'Zimbabwe', (SELECT id FROM core_currency WHERE code='zwd' LIMIT 1) );

-- general translations
INSERT INTO core_translation(code, source, en_gb, fr_fr, en_us) VALUES('dateFormat', 'd/m/Y', 'd/m/Y', 'd/m/Y', 'm/d/Y');


/* config constants in database */
INSERT INTO core_config(k, v) VALUES('framework_environment', 'dev');
INSERT INTO core_config(k, v) VALUES('email_active', 'false');
INSERT INTO core_config(k, v) VALUES('theme', 'materialize');
INSERT INTO core_config(k, v) VALUES('default_lang_code', (SELECT code FROM core_lang WHERE code='en_gb' LIMIT 1));
INSERT INTO core_config(k, v) VALUES('default_country_code', (SELECT code FROM core_country WHERE code='ch' LIMIT 1));
INSERT INTO core_config(k, v) VALUES('default_currency_code', (SELECT code FROM core_currency WHERE code='chf' LIMIT 1));
INSERT INTO core_config(k, v) VALUES('email_info', 'info@localhost');
INSERT INTO core_config(k, v) VALUES('email_noreply', 'no-reply@localhost');
INSERT INTO core_config(k, v)VALUES('version_core_install', '1.0.0');
INSERT INTO core_config(k, v)VALUES('version_core_update', '');
INSERT INTO core_config(k, v)VALUES('version_custom_install', '');
INSERT INTO core_config(k, v)VALUES('version_custom_update', '');

CREATE TABLE user_user (
    id SERIAL,
    create_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    email VARCHAR(128) NOT NULL,
    password VARCHAR(128) NOT NULL,
    firstname VARCHAR(128) NOT NULL DEFAULT '',
    lastname VARCHAR(128) NOT NULL DEFAULT '',
    phone VARCHAR(32) NOT NULL DEFAULT '',
    postcode VARCHAR(32) NOT NULL DEFAULT '',
    city VARCHAR(128) NOT NULL DEFAULT '',
    core_lang_id INTEGER,
    core_country_id INTEGER,
    core_currency_id INTEGER,
    core_theme_id INTEGER,
    is_backend_access BOOLEAN NOT NULL DEFAULT FALSE,
    is_active BOOLEAN NOT NULL DEFAULT FALSE,
    is_validated BOOLEAN DEFAULT FALSE,
    is_employee BOOLEAN NOT NULL DEFAULT FALSE,
    comment TEXT NOT NULL DEFAULT '',
    activation_code VARCHAR(128) NOT NULL,
    CONSTRAINT userUser_id_pk PRIMARY KEY(id),
    CONSTRAINT userUser_email_uk UNIQUE(email),
    CONSTRAINT userUser_coreLangId_fk FOREIGN KEY(core_lang_id) REFERENCES core_lang(id),
    CONSTRAINT userUser_coreCountryId_fk FOREIGN KEY(core_country_id) REFERENCES core_country(id),
    CONSTRAINT userUser_coreCurrencyId_fk FOREIGN KEY(core_currency_id) REFERENCES core_currency(id),
    CONSTRAINT userUser_coreThemeId_fk FOREIGN KEY(core_theme_id) REFERENCES core_theme(id)
);
CREATE TABLE user_detail (
    id SERIAL,
    user_id INTEGER NOT NULL,
    ext_id INTEGER DEFAULT NULL,
    CONSTRAINT coreUserDetail_id_pk PRIMARY KEY(id),
    CONSTRAINT coreUserDetail_coreUserId_fk FOREIGN KEY(user_id) REFERENCES user_user(id)
);

CREATE TABLE user_confirm (
    id SERIAL,
    user_id VARCHAR(128) NOT NULL DEFAULT '',
    key_confirmation VARCHAR(128) NOT NULL DEFAULT '',
    email VARCHAR(250) DEFAULT NULL,
    CONSTRAINT coreUserConfirm_pk PRIMARY KEY(id)
);

CREATE TABLE useruser_corefeature_rel (
    user_id INTEGER,
    core_feature_id INTEGER,
    CONSTRAINT userUserCoreFeatureRel_coreUserId_fk FOREIGN KEY(user_id) REFERENCES user_user(id),
    CONSTRAINT userUserCoreFeatureRel_coreMenuId_fk FOREIGN KEY(core_feature_id) REFERENCES core_feature(id),
    CONSTRAINT userUserCoreFeatureRel_userId_menuId_uk UNIQUE(user_id, core_feature_id)
);

--create user "system" with no features
INSERT INTO user_user(
    firstname, lastname, email, password,
    core_country_id, core_currency_id,
    core_lang_id,
    core_theme_id,
    is_employee, is_backend_access,
    is_active, activation_code,
    comment
) VALUES (
    'User', 'System', 'system@localhost', '',
    (SELECT id FROM core_country WHERE code='ch'),
    (SELECT id FROM core_currency WHERE code='chf'),
    (SELECT id FROM core_lang WHERE code='en_gb'),
    (SELECT id FROM core_theme WHERE code='default'),
    TRUE, TRUE, FALSE, 'no activation code needed',
    'system user : not really an user.'
);


INSERT INTO user_user(
    firstname, lastname, email, password,
    core_country_id, core_currency_id,
    core_lang_id,
    core_theme_id,
    is_employee, is_backend_access, is_active, activation_code,
    comment
) VALUES (
    'Super', 'Admin', 'superadmin@localhost', 'b6f5a1d77223794fcdb86a95ea24c20476deb006',
    (SELECT id FROM core_country WHERE code='ch'),
    (SELECT id FROM core_currency WHERE code='chf'),
    (SELECT id FROM core_lang WHERE code='en_gb'),
    (SELECT id FROM core_theme WHERE code='materialize'),
    TRUE, TRUE, TRUE, 'no activation code needed',
    'utilisateur administrateur'
);

-- core_feature: home
INSERT INTO core_feature_translation (code, source, en_gb, fr_fr) VALUES('menu_home_url', 'home', 'home', 'accueil');
INSERT INTO core_feature_translation (code, source, en_gb, fr_fr) VALUES('menu_home_label', 'Home', 'Home', 'Accueil');
INSERT INTO core_feature(model, code, url_feature_translation_id, label_feature_translation_id,
    is_menu_display, is_available_for_guest, is_active, priority, is_user_feature
) VALUES('home', 'home',
    (SELECT id FROM core_feature_translation WHERE code='menu_home_url' LIMIT 1),
    (SELECT id FROM core_feature_translation WHERE code='menu_home_label' LIMIT 1),
    TRUE, TRUE, TRUE, 1, TRUE
);

--feature for admin: home
INSERT INTO useruser_corefeature_rel(user_id, core_feature_id)
VALUES (
    (SELECT id FROM user_user WHERE email='superadmin@localhost' LIMIT 1),
    (SELECT id FROM core_feature WHERE code='home' LIMIT 1)
);

-- core_feature: register
INSERT INTO core_feature_translation (code, source, en_gb) VALUES('menu_register_url', 'register', 'register');
INSERT INTO core_feature_translation (code, source, en_gb) VALUES('menu_register_label', 'Register', 'Register');
INSERT INTO core_feature(model, code, url_feature_translation_id, label_feature_translation_id,
    is_menu_display, is_available_for_guest, is_active, priority
) VALUES('register', 'register',
    (SELECT id FROM core_feature_translation WHERE code='menu_register_url' LIMIT 1),
    (SELECT id FROM core_feature_translation WHERE code='menu_register_label' LIMIT 1),
    TRUE, TRUE, TRUE, 100
);

INSERT INTO core_feature_translation (code, source, en_gb, fr_fr) VALUES('menu_login_url', 'login', 'login', 'connexion');
INSERT INTO core_feature_translation (code, source, en_gb, fr_fr) VALUES('menu_login_label', 'Login', 'Login', 'Connexion');
INSERT INTO core_feature (
    model, code, url_feature_translation_id, label_feature_translation_id, is_menu_display, is_menu_backend, is_available_for_guest
) VALUES ('login', 'login',
    (SELECT id FROM core_feature_translation WHERE code='menu_login_url' LIMIT 1),
    (SELECT id FROM core_feature_translation WHERE code='menu_login_label' LIMIT 1),
    TRUE, FALSE, TRUE
);

INSERT INTO core_feature_translation (code, source, en_gb) VALUES('menu_forgotPassword_url', 'forgot-password', 'forgot-password');
INSERT INTO core_feature_translation (code, source, en_gb) VALUES('menu_forgotPassword_label', 'Forgot password?', 'Forgot password?');
INSERT INTO core_feature (model, code, url_feature_translation_id, label_feature_translation_id,
                          is_menu_display, is_user_feature, is_available_for_guest, priority
) VALUES ('forgot-password', 'forgot-password',
    (SELECT id FROM core_feature_translation WHERE code='menu_forgotPassword_url' LIMIT 1),
    (SELECT id FROM core_feature_translation WHERE code='menu_forgotPassword_label' LIMIT 1),
    FALSE, FALSE, TRUE, 100
);


-- core_feature: my-profile
INSERT INTO core_feature_translation (code, source, en_gb, fr_fr) VALUES('menu_myProfile_url', 'my-profile', 'my-profile', 'mon-compte');
INSERT INTO core_feature_translation (code, source, en_gb, fr_fr) VALUES('menu_myProfile_label', 'My Profile', 'My Profile', 'Mon Compte');
INSERT INTO core_feature (
    model, code, url_feature_translation_id, label_feature_translation_id, is_menu_display, is_menu_backend, is_available_for_guest, priority, is_user_feature
) VALUES ('my-profile', 'my-profile',
    (SELECT id FROM core_feature_translation WHERE code='menu_myProfile_url' LIMIT 1),
    (SELECT id FROM core_feature_translation WHERE code='menu_myProfile_label' LIMIT 1),
    TRUE, FALSE, FALSE, 20, TRUE
);
--feature for admin
INSERT INTO useruser_corefeature_rel(user_id, core_feature_id)
VALUES (
    (SELECT id FROM user_user WHERE email='superadmin@localhost' LIMIT 1),
    (SELECT id FROM core_feature WHERE code='my-profile' LIMIT 1)
);


-- core_feature: logout
INSERT INTO core_feature_translation (code, source, en_gb, fr_fr, ko_kr) VALUES ('menu_logout_url', 'logout', 'logout', 'logout', '');
INSERT INTO core_feature_translation (code, source, en_gb, fr_fr, ko_kr) VALUES ('menu_logout_label', 'Logout', 'Logout', 'Déconnexion', '');
INSERT INTO core_feature (model, code, url_feature_translation_id, label_feature_translation_id, is_menu_display, is_menu_backend, is_available_for_guest, priority, is_user_feature
) VALUES('logout', 'logout',
    (SELECT id FROM core_feature_translation WHERE code='menu_logout_url' LIMIT 1),
    (SELECT id FROM core_feature_translation WHERE code='menu_logout_label' LIMIT 1),
    TRUE, FALSE, FALSE, 102, TRUE
);
--feature for admin: logout
INSERT INTO useruser_corefeature_rel(user_id, core_feature_id)
VALUES (
    (SELECT id FROM user_user WHERE email='superadmin@localhost' LIMIT 1),
    (SELECT id FROM core_feature WHERE code='logout' LIMIT 1)
);


-- core_feature: terms-of-use
INSERT INTO core_feature_translation (code, source, en_gb) VALUES('menu_termsOfUse_url', 'terms-of-use', 'terms-of-use');
INSERT INTO core_feature_translation (code, source, en_gb) VALUES('menu_termsOfUse_label', 'Terms Of Use', 'Terms Of Use');
INSERT INTO core_feature(model, code, url_feature_translation_id, label_feature_translation_id,
    is_menu_display, is_available_for_guest, is_active, priority, is_user_feature
) VALUES('terms-of-use', 'terms-of-use',
    (SELECT id FROM core_feature_translation WHERE code='menu_termsOfUse_url' LIMIT 1),
    (SELECT id FROM core_feature_translation WHERE code='menu_termsOfUse_label' LIMIT 1),
    FALSE, TRUE, TRUE, 200, TRUE
);

-- core_feature: privacy-policy
INSERT INTO core_feature_translation (code, source, en_gb) VALUES('menu_privacyPolicy_url', 'privacy-policy', 'privacy-policy');
INSERT INTO core_feature_translation (code, source, en_gb) VALUES('menu_privacyPolicy_label', 'Privacy Policy', 'Privacy Policy');
INSERT INTO core_feature(model, code, url_feature_translation_id, label_feature_translation_id,
    is_menu_display, is_available_for_guest, is_active, priority, is_user_feature
) VALUES('privacy-policy', 'privacy-policy',
    (SELECT id FROM core_feature_translation WHERE code='menu_privacyPolicy_url' LIMIT 1),
    (SELECT id FROM core_feature_translation WHERE code='menu_privacyPolicy_label' LIMIT 1),
    FALSE, TRUE, TRUE, 1000, TRUE
);

-- core_feature: cookies-policy
INSERT INTO core_feature_translation (code, source, en_gb) VALUES('menu_cookiesPolicy_url', 'cookies-policy', 'cookies-policy');
INSERT INTO core_feature_translation (code, source, en_gb) VALUES('menu_cookiesPolicy_label', 'Cookies Policy', 'Cookies Policy');
INSERT INTO core_feature(model, code, url_feature_translation_id, label_feature_translation_id,
    is_menu_display, is_available_for_guest, is_active, priority, is_user_feature
) VALUES('cookies-policy', 'cookies-policy',
    (SELECT id FROM core_feature_translation WHERE code='menu_cookiesPolicy_url' LIMIT 1),
    (SELECT id FROM core_feature_translation WHERE code='menu_cookiesPolicy_label' LIMIT 1),
    FALSE, TRUE, TRUE, 1000, TRUE
);

INSERT INTO core_translation(code, source, en_gb) VALUES('display_cookie_message', 'This site uses cookies. By visiting it, you agree to our privacy policy.', 'This site uses cookies. By visiting it, you agree to our privacy policy.');


INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES('message_titleSuccessfulLogged', 'Login Successful', 'Login Successful', 'Succès Connexion');
INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES('message_contentSuccessfulLogged',
-- source
'You have been successfully logged in. You can start trading immediately!<br/>
To do so, please go to [data] page.',
-- en_gb
'You have been successfully logged in. You can start trading immediately!<br/>
To do so, please go to [data] page.',
-- fr_fr
'Vous êtes maintenant connecté. Vous pouvez commencer votre trade maintenant.<br/>
Pour ce faire, allez sur la page [data].'
);

-- core_feature: list-translations
INSERT INTO core_feature_translation (code, source, en_gb, fr_fr) VALUES('menu_listTranslations_url', 'list-translations', 'list-translations', 'lister-traductions');
INSERT INTO core_feature_translation (code, source, en_gb, fr_fr) VALUES('menu_listTranslations_label', 'List Translations', 'List Translations', 'Lister Traductions');
INSERT INTO core_feature (
    model, code, url_feature_translation_id, label_feature_translation_id, is_menu_display, is_menu_backend, is_available_for_guest, is_user_feature
) VALUES ('list-translations', 'list-translations',
    (SELECT id FROM core_feature_translation WHERE code='menu_listTranslations_url' LIMIT 1),
    (SELECT id FROM core_feature_translation WHERE code='menu_listTranslations_label' LIMIT 1),
    TRUE, TRUE, FALSE, FALSE
);
--rule for admin
INSERT INTO useruser_corefeature_rel(user_id, core_feature_id)
VALUES (
    (SELECT id FROM user_user WHERE email='superadmin@localhost' LIMIT 1),
    (SELECT id FROM core_feature WHERE code='list-translations' LIMIT 1)
);

-- core_feature: edit-translation
INSERT INTO core_feature_translation (code, source, en_gb, fr_fr) VALUES('menu_editTranslation_url', 'edit-translation', 'edit-translation', 'editer-traduction');
INSERT INTO core_feature_translation (code, source, en_gb, fr_fr) VALUES('menu_editTranslation_label', 'Edit Translation', 'Edit Translation', 'Éditer Traduction');
INSERT INTO core_feature (model, code, url_feature_translation_id, label_feature_translation_id,
    is_menu_display, is_menu_backend, is_available_for_guest, is_user_feature
) VALUES ('edit-translation', 'edit-translation',
    (SELECT id FROM core_feature_translation WHERE code='menu_editTranslation_url' LIMIT 1),
    (SELECT id FROM core_feature_translation WHERE code='menu_editTranslation_label' LIMIT 1),
    FALSE, TRUE, FALSE, FALSE
);
--rule for admin
INSERT INTO useruser_corefeature_rel(user_id, core_feature_id)
VALUES (
    (SELECT id FROM user_user WHERE email='superadmin@localhost' LIMIT 1),
    (SELECT id FROM core_feature WHERE code='edit-translation' LIMIT 1)
);

-- Translations for Wefra Home Page
INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES('page_home_title', 'Welcome on WeFra', 'Welcome on WeFra', 'Bienvenue sur WeFra');
INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES('page_home_content', 'WeFra is the most simple web framework in the world!', 'WeFra is the most simple web framework in the world!', 'WeFra est le framework web le plus simple au monde!');

-- Translations for login form
INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES('login_form_email', 'Email', 'Email', 'E-mail');
INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES('login_form_password', 'Password', 'Password', 'Mot de passe');
INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES ('login_form_submit', 'Log In Now', 'Log In Now', 'Connexion');

-- Translations trade form
INSERT INTO core_translation(code, source, en_gb, fr_fr)
VALUES('trade_form_panelHeading', 'Submit Your Trade', 'Submit Your Trade', 'Envoyez votre trade');

-- Translations my-profile webpage
INSERT INTO core_translation (code, source, en_gb, fr_fr, ko_kr) VALUES ('myProfile_password', 'Password', 'Password', 'Mot de passe', '');
INSERT INTO core_translation (code, source, en_gb, fr_fr, ko_kr) VALUES ('myProfile_placeholderOldPassword', 'Current password', 'Current password', 'Mot de passe actuel', '');
INSERT INTO core_translation (code, source, en_gb, fr_fr, ko_kr) VALUES ('myProfile_placeholderNewPassword', 'New password', 'New password', 'Nouveau mot de passe', '');
INSERT INTO core_translation (code, source, en_gb, fr_fr, ko_kr) VALUES ('myProfile_placeholderConfirmPassword', 'Confirm new password', 'Confirm new password', 'Confirmation mot de passe', '');
INSERT INTO core_translation (code, source, en_gb, fr_fr, ko_kr) VALUES ('myProfile_submitChangePassword', 'Change', 'Change', 'Changer', '');
INSERT INTO core_translation (code, source, en_gb, fr_fr)
VALUES ('myProfile_passwordConfirmationMessage_success',
'Your password has been updated successfully. ',
'Your password has been updated successfully. ',
'Votre mot de passe a été modifié avec succès');
INSERT INTO core_translation (code, source, en_gb, fr_fr)
VALUES ('myProfile_passwordConfirmationMessage_failed',
'Sorry, something went wrong. Please verify your details and try again.',
'Sorry, something went wrong. Please verify your details and try again.',
'Désolé, une erreur s''est produite. Vérifiez vos données et essayer à nouveau.');
INSERT INTO core_translation (code, source, en_gb, fr_fr)
VALUES ('myProfile_passwordConfirmationMessage_failedBadPassword',
'Sorry, your password wasn’t updated. Please try again.',
'Sorry, your password wasn’t updated. Please try again.',
'Désolé, votre mot de passe n''a pu être changé. Veuillez essayer à nouveau.');
INSERT INTO core_translation (code, source, en_gb, fr_fr, ko_kr) VALUES ('myProfile_passwordConfirmationMessage_failedPasswordConfirm', 'myProfile_passwordConfirmationMessage_failedPasswordConfirm to_translate', '', '', '');
INSERT INTO core_translation (code, source, en_gb, fr_fr, ko_kr) VALUES ('myProfile_passwordConfirmationMessage_noState', 'myProfile_passwordConfirmationMessage_noState to_translate', '', '', '');


-- list-translations and edit-translation menu
INSERT INTO core_translation(code, source, en_gb, fr_fr, ko_kr) VALUES('webpage_listTranslations_pageTitle', 'Translations', 'Translations', 'Traductions', '');
INSERT INTO core_translation(code, source, en_gb, fr_fr, ko_kr) VALUES('webpage_listTranslations_codeTitle', 'Code', 'Code', 'Code', '');
INSERT INTO core_translation(code, source, en_gb, fr_fr, ko_kr) VALUES('webpage_listTranslations_sourceTitle', 'Source', 'Source', 'Source', '');
INSERT INTO core_translation(code, source, en_gb, fr_fr, ko_kr) VALUES('webpage_listTranslations_translateButtons', 'Translate', 'Translate', 'Traduire', '');

INSERT INTO core_translation(code, source, en_gb, fr_fr, ko_kr) VALUES('webpage_editTranslation_title', 'Edit translation', 'Edit translation', 'Éditer traduction', '');
INSERT INTO core_translation(code, source, en_gb, fr_fr, ko_kr) VALUES('webpage_editTranslation_sourceLabel', 'Source', 'Source', 'Source', '');
INSERT INTO core_translation(code, source, en_gb, fr_fr, ko_kr) VALUES('webpage_editTranslation_translationLabel', 'Translation', 'Translation', 'Traduction', '');
INSERT INTO core_translation(code, source, en_gb, fr_fr, ko_kr) VALUES('webpage_editTranslation_saveButton', 'Save', 'Save', 'Enregistrer', '');
INSERT INTO core_translation(code, source, en_gb, fr_fr, ko_kr) VALUES('webpage_editTranslation_ok', 'translation updated with success', 'translation updated with success', '', '');
INSERT INTO core_translation(code, source, en_gb, fr_fr, ko_kr) VALUES('webpage_editTranslation_no_ok', 'translation has not been updated', 'translation has not been updated', '', '');
INSERT INTO core_translation(code, source, en_gb, fr_fr, ko_kr) VALUES('webpage_editTranslation_no_state', 'unknown error happened', 'unknown error happened', '', '');

INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES ('myProfile_title_changePassword', 'Change Password', 'Change Password', 'Changer Mot De Passe');
INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES ('myProfile_title_personalInformation', 'Personal Information', 'Personal Information', 'Mon Identité');

INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES ('myProfile_firstName', 'First Name', 'First Name', 'Prénom');
INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES ('myProfile_lastName', 'Last Name', 'Last Name', 'Nom');
INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES ('myProfile_phone', 'Phone', 'Phone', 'Téléphone');
INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES ('myProfile_language', 'Language', 'Language', 'Langue');
INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES ('myProfile_country', 'Country', 'Country', 'Pays');
INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES ('myProfile_city', 'City', 'City', 'Ville');
INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES ('myProfile_postcode', 'Postcode', 'Postcode', 'Code Postal');
INSERT INTO core_translation(code, source, en_gb, fr_fr) VALUES ('myProfile_currency', 'Currency', 'Currency', 'Devise');
INSERT INTO core_translation(code, source, en_gb, fr_fr)
VALUES ('myProfile_submitPersonalData',
'Update my personal details',
'Update my personal details',
'Actualiser mes informations personnelles');
INSERT INTO core_translation(code, source, en_gb, fr_fr)
VALUES ('message_successUpdatePersonalData',
'Your details have been updated successfully.',
'Your details have been updated successfully.',
'Vos informations ont été mises à jour avec succès.');
INSERT INTO core_translation(code, source, en_gb, fr_fr)
VALUES ('message_failedUpdatePersonalData',
'Sorry, your changes haven’t been saved. Please try again and contact us, if the problem persists.',
'Sorry, your changes haven’t been saved. Please try again and contact us, if the problem persists.',
'Désolé, vos modifications n''ont pas pu être mises à jour. Veuillez essayer à nouveau. Si le problème persiste, contactez-nous.');


INSERT INTO core_translation(code, source, en_gb, fr_fr)
VALUES ('message_requiredFieldsNotFilled',
--source
'All required fields must be filled.',
-- en_gb
'All required fields must be filled.',
-- fr_fr
'Tous les champs obligatoires doivent être renseignés.'
);


