From d9a5730ab29aaaea68f5c6b1175746bc8b77ae43 Mon Sep 17 00:00:00 2001
From: gsh18 <gsh18@inf.ufpr.br>
Date: Mon, 8 Jul 2019 08:31:05 -0300
Subject: [PATCH] Resolve "Arrumar form_updates e input_updates"

---
 workspace/create/00-core-tables.sql   | 15 ++++++++++-----
 workspace/fixture/form_update.csv     |  1 +
 workspace/fixture/form_updates.csv    |  0
 workspace/fixture/input_operation.csv |  4 ++++
 workspace/fixture/input_update.csv    |  1 +
 workspace/fixture/input_updates.csv   |  0
 6 files changed, 16 insertions(+), 5 deletions(-)
 create mode 100644 workspace/fixture/form_update.csv
 delete mode 100644 workspace/fixture/form_updates.csv
 create mode 100644 workspace/fixture/input_operation.csv
 create mode 100644 workspace/fixture/input_update.csv
 delete mode 100644 workspace/fixture/input_updates.csv

diff --git a/workspace/create/00-core-tables.sql b/workspace/create/00-core-tables.sql
index 7e3fd55..bc7e5ba 100644
--- a/workspace/create/00-core-tables.sql
+++ b/workspace/create/00-core-tables.sql
@@ -41,16 +41,21 @@ CREATE TABLE input_answer (
     placement INTEGER
 );
 
-CREATE TABLE form_updates (
+CREATE TABLE form_update (
     id SERIAL PRIMARY KEY,
     id_form INTEGER,
-    update_data TEXT
+    update_date TIMESTAMP
 );
 
-CREATE TABLE input_updates (
+CREATE TABLE input_update (
     id SERIAL PRIMARY KEY,
-    id_form_updates INTEGER,
+    id_form_update INTEGER,
     id_input INTEGER,
-    input_operation char(3),
+    input_operation_id INTEGER,
     value TEXT
 );
+
+CREATE TABLE input_operation (
+    id INTEGER,
+    name TEXT
+);
diff --git a/workspace/fixture/form_update.csv b/workspace/fixture/form_update.csv
new file mode 100644
index 0000000..730fde1
--- /dev/null
+++ b/workspace/fixture/form_update.csv
@@ -0,0 +1 @@
+id;id_form;update_date
diff --git a/workspace/fixture/form_updates.csv b/workspace/fixture/form_updates.csv
deleted file mode 100644
index e69de29..0000000
diff --git a/workspace/fixture/input_operation.csv b/workspace/fixture/input_operation.csv
new file mode 100644
index 0000000..4466b21
--- /dev/null
+++ b/workspace/fixture/input_operation.csv
@@ -0,0 +1,4 @@
+id;name
+0;ADD
+1;REMOVE
+2;SWAP
diff --git a/workspace/fixture/input_update.csv b/workspace/fixture/input_update.csv
new file mode 100644
index 0000000..189949b
--- /dev/null
+++ b/workspace/fixture/input_update.csv
@@ -0,0 +1 @@
+id;id_form_update;id_input;input_operation_id;value
diff --git a/workspace/fixture/input_updates.csv b/workspace/fixture/input_updates.csv
deleted file mode 100644
index e69de29..0000000
-- 
GitLab