CREATE SCHEMA "import";

CREATE TABLE "import".choix_personnes (
	civility varchar(50) NULL,
	gender varchar(50) NULL,
	maritalstatus varchar(50) NULL,
	country varchar(50) NULL,
	household_composition_type varchar(50) NULL,
	household_position varchar(50) NULL
);

CREATE TABLE "import".personnes (
	id varchar(50) NULL,
	civility varchar(50) NULL,
	lastname varchar(50) NULL,
	firstname varchar(50) NULL,
	gender varchar(50) NULL,
	gendercomment varchar(50) NULL,
	nationality varchar(50) NULL,
	memo varchar(50) NULL,
	birthdate varchar(50) NULL,
	place_of_birth varchar(50) NULL,
	countryofbirth varchar(50) NULL,
	deathdate varchar(50) NULL,
	email varchar(50) NULL,
	phonenumber varchar(50) NULL,
	mobilenumber varchar(50) NULL,
	contactinfo varchar(50) NULL,
	street varchar(50) NULL,
	extra varchar(50) NULL,
	streetnumber varchar(50) NULL,
	postcode varchar(50) NULL,
	country varchar(50) NULL,
	validfrom varchar(50) NULL,
	maritalstatus varchar(50) NULL,
	maritalstatuscomment varchar(50) NULL,
	numberofchildren integer NULL,
	household_composition_type varchar(50) NULL,
	household_position varchar(50) NULL,
	household_startdate varchar(50) NULL
);

CREATE TABLE "import".choix_periodes (
	closingmotive varchar(50) NULL,
	origin varchar(50) NULL,
	acp_scopes varchar(50) NULL,
	job varchar(50) NULL,
	referrer varchar(50) NULL,
	parent varchar(50) NULL,
	enfant varchar(50) NULL,
	acp_social_issues varchar(50) NULL,
	work_social_action varchar(50) NULL,
	street varchar(128) NULL,
	extra varchar(50) NULL,
	streetnumber integer NULL,
	postcode integer NULL,
	country varchar(50) NULL
);


CREATE TABLE "import".periodes (
	id varchar(50) NULL,
	nom varchar(50) NULL,
	openingdate varchar(50) NULL,
	closingdate varchar(50) NULL,
	closingmotive varchar(50) NULL,
	origin varchar(50) NULL,
	remark integer NULL,
	intensity varchar(50) NULL,
	referrer varchar(50) NULL,
	job varchar(50) NULL,
	acp_scopes varchar(50) NULL,
	"address" varchar(50) NULL,
	personlocation varchar(50) NULL,
	addresslocation varchar(50) NULL,
	acp_socialissues varchar(50) NULL,
	work_socialaction varchar(50) NULL,
	comment1_content varchar(50) NULL,
	comment2_content varchar(50) NULL,
	comment3_content varchar(50) NULL,
	comment4_content varchar(50) NULL,
	comment5_content varchar(50) NULL
);

CREATE TABLE "import".choix_localisations (
	title varchar(50) NULL,
	"addressRequired" varchar(32) NULL,
	"availableForUsers" boolean DEFAULT TRUE,
    "contactData" varchar(32) NULL,
	"defaultFor" varchar(32) NULL,
	"editableByUsers" boolean DEFAULT TRUE
);

CREATE TABLE "import".localisations (
	id varchar(50) NULL,
	locname varchar(50) NULL,
	phonenumber varchar(50) NULL,
	phonenumber1 varchar(50) NULL,
	email varchar(50) NULL,
	loctype varchar(50) NULL,
	street varchar(50) NULL,
	extra varchar(50) NULL,
	streetnumber varchar(50) NULL,
	postcode varchar(50) NULL,
	country varchar(50) NULL
);

CREATE TABLE "import".users (
	id varchar(50) NULL,
	"login" varchar(50) NULL,
	civility varchar(50) NULL,
	nom varchar(50) NULL,
	prenom varchar(50) NULL,
	libl varchar(50) NULL,
	nom_prenom varchar(50) NULL,
	phonenumber varchar(50) NULL,
	email varchar(50) NULL,
	metier varchar(50) NULL
);

CREATE TABLE  "import".tiers (
    ID varchar(50) NULL,
    CATEGORIE VARCHAR(255),
    SECTEUR_AS VARCHAR(255),
    COMMUNE VARCHAR(255),
    NOM VARCHAR(255),
    ACRONYM VARCHAR(64),
    PHONENUMBER VARCHAR(20),
    PHONENUMBER_2 VARCHAR(20),
    EMAIL VARCHAR(255),
    PERSONNE_NOM VARCHAR(255),
    PERSONNE_prenom VARCHAR(255),
    PERSONNE_CIVILITE VARCHAR(20),
    adresse TEXT,
    CP VARCHAR(10),
    TIERS_PARENT VARCHAR(255),
    TIERS_PHYSIQUE_VS_MORALE VARCHAR(50),
    POINT_DE_CONTACT_SUR_LE_TERRITOIRE TEXT,
    COORDONNEES TEXT,
    HORAIRES TEXT,
    OBSERVATIONS TEXT
);