summaryrefslogtreecommitdiffstats
path: root/migrations/2020-06-07-161450_create_transaction
diff options
context:
space:
mode:
authorJokler <jokler@protonmail.com>2020-06-21 06:37:46 +0200
committerJokler <jokler@protonmail.com>2020-06-21 06:37:46 +0200
commite6468b012d5b33dd16992652da57f11dd5a6e82f (patch)
treee89add440df79d4036b9b44d8c77ee6d69e67201 /migrations/2020-06-07-161450_create_transaction
downloadjoklerpoints-e6468b012d5b33dd16992652da57f11dd5a6e82f.tar.gz
joklerpoints-e6468b012d5b33dd16992652da57f11dd5a6e82f.zip
Initial commitHEADmaster
Diffstat (limited to 'migrations/2020-06-07-161450_create_transaction')
-rw-r--r--migrations/2020-06-07-161450_create_transaction/down.sql1
-rw-r--r--migrations/2020-06-07-161450_create_transaction/up.sql12
2 files changed, 13 insertions, 0 deletions
diff --git a/migrations/2020-06-07-161450_create_transaction/down.sql b/migrations/2020-06-07-161450_create_transaction/down.sql
new file mode 100644
index 0000000..91345dc
--- /dev/null
+++ b/migrations/2020-06-07-161450_create_transaction/down.sql
@@ -0,0 +1 @@
+DROP TABLE transactions;
diff --git a/migrations/2020-06-07-161450_create_transaction/up.sql b/migrations/2020-06-07-161450_create_transaction/up.sql
new file mode 100644
index 0000000..fb81016
--- /dev/null
+++ b/migrations/2020-06-07-161450_create_transaction/up.sql
@@ -0,0 +1,12 @@
+CREATE TABLE transactions (
+ id SERIAL NOT NULL PRIMARY KEY,
+ `date` timestamp NOT NULL DEFAULT current_timestamp(),
+ sender bigint UNSIGNED NOT NULL,
+ receiver bigint UNSIGNED NOT NULL,
+ amount bigint UNSIGNED NOT NULL,
+ sender_balance bigint UNSIGNED NOT NULL,
+ receiver_balance bigint UNSIGNED NOT NULL,
+ purpose varchar(70) NOT NULL,
+ CONSTRAINT fk_sender_id FOREIGN KEY (sender) REFERENCES users (id),
+ CONSTRAINT fk_receiver_id FOREIGN KEY (receiver) REFERENCES users (id)
+);