-- Script de création et mise à jour de la base, en cas
-- de modification de la structure, il convient d'incrémenter le
-- numéro de version de la constante DATABASE_VERSION dans as.android.mview.dataaccess.DatabaseHelper
;


CREATE TABLE IF NOT EXISTS [Account] (
	login				text	PRIMARY KEY NOT NULL,
	password			text,
	userId      		text,
	firstname			text,
	lastname			text,
	token				text
);

CREATE TABLE IF NOT EXISTS [Guardroom] (
	id					text	PRIMARY KEY NOT NULL,
	name				text
);

CREATE TABLE IF NOT EXISTS [EventLogSearch] (
	id					text 	PRIMARY KEY NOT NULL,
	eventTypesMask		integer,
	useDate     		integer,
	maxDate  			datetime,
	minDate				datetime,
	lastReadDateUtc		datetime,
	hasMoreRow			integer,
	insertedRowCount	integer,
	lastInsertedRowID	integer,
	lastInsertedDayID	integer
);

CREATE TABLE IF NOT EXISTS [EventLog] (
	rowPosition         integer PRIMARY KEY NOT NULL,
	rowType             integer,
	id					text,
	eventType           integer,
	priority            integer,
	date	            datetime,
	username            text,
	description         text
);

CREATE TABLE IF NOT EXISTS [DataCache] (
	id					text PRIMARY KEY NOT NULL,
	dateUtc             datetime,
	json         		text
);

CREATE TABLE IF NOT EXISTS [VolatileData] (
	id					text PRIMARY KEY NOT NULL,
	json         		text
);




