CREATE TABLE "tupdate_settings" ( "key" varchar(255) default '' PRIMARY KEY, "value" varchar(255) default '');
INSERT INTO "tupdate_settings" VALUES ('current_update', '0'), ('customer_key', 'PANDORA-FREE'), ('keygen_path', '/usr/share/pandora/util/keygen'), ('update_server_host', 'www.artica.es'), ('update_server_port', '80'), ('update_server_path', '/pandoraupdate4/server.php'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', '');
CREATE TABLE "tupdate_package"( "id" SERIAL NOT NULL PRIMARY KEY, "timestamp"  TIMESTAMP without time zone default NULL, "description" varchar(255) default '');
CREATE TYPE type_tupdate_type AS ENUM ('code', 'db_data', 'db_schema', 'binary');
CREATE TABLE "tupdate" ( "id" SERIAL NOT NULL PRIMARY KEY, "type" type_tupdate_type, "id_update_package" INTEGER default 0 REFERENCES "tupdate_package"("id") ON UPDATE CASCADE ON DELETE CASCADE, "filename" varchar(250) default '', "checksum" varchar(250) default '', "previous_checksum" varchar(250) default '', "svn_version" INTEGER default 0, "data" TEXT default '', "data_rollback" TEXT default '', "description" TEXT default '', "db_table_name" varchar(140) default '', "db_field_name" varchar(140) default '', "db_field_value" varchar(1024) default '');
CREATE TABLE "tupdate_journal" ( "id" SERIAL NOT NULL PRIMARY KEY, "id_update" INTEGER default 0 REFERENCES "tupdate"("id") ON UPDATE CASCADE ON DELETE CASCADE);
