From 8a294c4d68db8e3d0436917cf5cefcc36f8e684e Mon Sep 17 00:00:00 2001
From: Alejandro Gallardo Escobar <alex@artica.es>
Date: Thu, 11 Dec 2014 16:11:21 +0100
Subject: [PATCH] Added a new table called 'tuser_double_auth'

---
 .../extras/pandoradb_migrate_5.1_to_6.0.mysql.sql  | 12 ++++++++++++
 .../extras/pandoradb_migrate_5.1_to_6.0.oracle.sql | 14 +++++++++++++-
 .../pandoradb_migrate_5.1_to_6.0.postgreSQL.sql    | 12 +++++++++++-
 pandora_console/pandoradb.oracle.sql               | 11 +++++++++++
 pandora_console/pandoradb.postgreSQL.sql           |  9 +++++++++
 pandora_console/pandoradb.sql                      | 12 ++++++++++++
 6 files changed, 68 insertions(+), 2 deletions(-)

diff --git a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql
index b5a8ca7aa3..1f6e37bcac 100755
--- a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql
+++ b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql
@@ -14,3 +14,15 @@ ALTER TABLE tlayout_data ADD COLUMN `border_width` INTEGER UNSIGNED NOT NULL def
 ALTER TABLE tlayout_data ADD COLUMN `border_color` varchar(200) DEFAULT "";
 ALTER TABLE tlayout_data ADD COLUMN `fill_color` varchar(200) DEFAULT "";
 
+/* 2014/12/10 */
+-- ----------------------------------------------------------------------
+-- Table `tuser_double_auth`
+-- ----------------------------------------------------------------------
+CREATE TABLE IF NOT EXISTS `tuser_double_auth` (
+	`id` int(10) unsigned NOT NULL auto_increment,
+	`id_user` varchar(60) NOT NULL,
+	`secret` varchar(20) NOT NULL,
+	PRIMARY KEY (`id`),
+	UNIQUE (`id_user`),
+	FOREIGN KEY (`id_user`) REFERENCES tusuario(`id_user`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
\ No newline at end of file
diff --git a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql
index 182394c445..b3cdb6b13c 100755
--- a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql
+++ b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql
@@ -12,4 +12,16 @@ ALTER TABLE tlayout_data DROP COLUMN no_link_color;
 ALTER TABLE tlayout_data DROP COLUMN label_color;
 ALTER TABLE tlayout_data ADD COLUMN border_width INTEGER NOT NULL default 0;
 ALTER TABLE tlayout_data ADD COLUMN border_color varchar(200) DEFAULT "";
-ALTER TABLE tlayout_data ADD COLUMN fill_color varchar(200) DEFAULT "";
\ No newline at end of file
+ALTER TABLE tlayout_data ADD COLUMN fill_color varchar(200) DEFAULT "";
+
+/* 2014/12/10 */
+-- ----------------------------------------------------------------------
+-- Table `tuser_double_auth`
+-- ----------------------------------------------------------------------
+CREATE TABLE tuser_double_auth (
+	id NUMBER(10, 0) NOT NULL PRIMARY KEY,
+	id_user VARCHAR2(60) NOT NULL REFERENCES tusuario(id_user) ON DELETE CASCADE,
+	secret VARCHAR2(20) NOT NULL
+);
+CREATE SEQUENCE tuser_double_auth_s INCREMENT BY 1 START WITH 1;
+CREATE OR REPLACE TRIGGER tuser_double_auth_inc BEFORE INSERT ON tuser_double_auth REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tuser_double_auth_s.nextval INTO :NEW.ID FROM dual; END tuser_double_auth_inc;;
\ No newline at end of file
diff --git a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql
index 81ae7e6c05..8fa2e6346c 100755
--- a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql
+++ b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql
@@ -12,4 +12,14 @@ ALTER TABLE "tlayout_data" DROP COLUMN "no_link_color";
 ALTER TABLE "tlayout_data" DROP COLUMN "label_color";
 ALTER TABLE "tlayout_data" ADD COLUMN "border_width" INTEGER NOT NULL default 0;
 ALTER TABLE "tlayout_data" ADD COLUMN "border_color" varchar(200) DEFAULT "";
-ALTER TABLE "tlayout_data" ADD COLUMN "fill_color" varchar(200) DEFAULT "";
\ No newline at end of file
+ALTER TABLE "tlayout_data" ADD COLUMN "fill_color" varchar(200) DEFAULT "";
+
+/* 2014/12/10 */
+-- ----------------------------------------------------------------------
+-- Table `tuser_double_auth`
+-- ----------------------------------------------------------------------
+CREATE TABLE "tuser_double_auth" (
+	"id" SERIAL NOT NULL PRIMARY KEY,
+	"id_user" varchar(60) NOT NULL UNIQUE REFERENCES "tusuario"("id_user") ON DELETE CASCADE,
+	"secret" varchar(20) NOT NULL
+);
\ No newline at end of file
diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql
index a97ba1e163..a7af86524b 100755
--- a/pandora_console/pandoradb.oracle.sql
+++ b/pandora_console/pandoradb.oracle.sql
@@ -1047,6 +1047,17 @@ CREATE TABLE tusuario_perfil (
 CREATE SEQUENCE tusuario_perfil_s INCREMENT BY 1 START WITH 1;
 CREATE OR REPLACE TRIGGER tusuario_perfil_inc BEFORE INSERT ON tusuario_perfil REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tusuario_perfil_s.nextval INTO :NEW.ID_UP FROM dual; END tusuario_perfil_inc;;
 
+-- ----------------------------------------------------------------------
+-- Table `tuser_double_auth`
+-- ----------------------------------------------------------------------
+CREATE TABLE tuser_double_auth (
+	id NUMBER(10, 0) NOT NULL PRIMARY KEY,
+	id_user VARCHAR2(60) NOT NULL REFERENCES tusuario(id_user) ON DELETE CASCADE,
+	secret VARCHAR2(20) NOT NULL
+);
+CREATE SEQUENCE tuser_double_auth_s INCREMENT BY 1 START WITH 1;
+CREATE OR REPLACE TRIGGER tuser_double_auth_inc BEFORE INSERT ON tuser_double_auth REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tuser_double_auth_s.nextval INTO :NEW.ID FROM dual; END tuser_double_auth_inc;;
+
 -- ---------------------------------------------------------------------
 -- Table "tnews"
 -- ---------------------------------------------------------------------
diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql
index 20fd07b0ae..1ae3d6f4c5 100755
--- a/pandora_console/pandoradb.postgreSQL.sql
+++ b/pandora_console/pandoradb.postgreSQL.sql
@@ -926,6 +926,15 @@ CREATE TABLE "tusuario_perfil" (
 	"tags" text NOT NULL
 );
 
+-- ----------------------------------------------------------------------
+-- Table `tuser_double_auth`
+-- ----------------------------------------------------------------------
+CREATE TABLE "tuser_double_auth" (
+	"id" SERIAL NOT NULL PRIMARY KEY,
+	"id_user" varchar(60) NOT NULL UNIQUE REFERENCES "tusuario"("id_user") ON DELETE CASCADE,
+	"secret" varchar(20) NOT NULL
+);
+
 -- -----------------------------------------------------
 -- Table `tnews`
 -- -----------------------------------------------------
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index 376ae670aa..6abc69e96c 100755
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -999,6 +999,18 @@ CREATE TABLE IF NOT EXISTS `tusuario_perfil` (
 	PRIMARY KEY  (`id_up`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+-- ----------------------------------------------------------------------
+-- Table `tuser_double_auth`
+-- ----------------------------------------------------------------------
+CREATE TABLE IF NOT EXISTS `tuser_double_auth` (
+	`id` int(10) unsigned NOT NULL auto_increment,
+	`id_user` varchar(60) NOT NULL,
+	`secret` varchar(20) NOT NULL,
+	PRIMARY KEY (`id`),
+	UNIQUE (`id_user`),
+	FOREIGN KEY (`id_user`) REFERENCES tusuario(`id_user`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
 -- ----------------------------------------------------------------------
 -- Table `tnews`
 -- ----------------------------------------------------------------------