From f2d99c4f0fa7067165794c1cbe069f08e9a823da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Mon, 1 May 2023 19:19:10 +0200 Subject: [PATCH] RVRNEXT-6 add migration for transaction db structure --- .../structure/20230428_2150_transactions.sql | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 database/migrations/structure/20230428_2150_transactions.sql diff --git a/database/migrations/structure/20230428_2150_transactions.sql b/database/migrations/structure/20230428_2150_transactions.sql new file mode 100644 index 0000000..d6f0645 --- /dev/null +++ b/database/migrations/structure/20230428_2150_transactions.sql @@ -0,0 +1,19 @@ +CREATE TABLE `transactions` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `community_id` int(10) unsigned NOT NULL, + `currency_id` int(10) unsigned NOT NULL, + `payer_user_id` int(10) unsigned NOT NULL, + `payee_user_id` int(10) unsigned NULL, + `description` varchar(255) NOT NULL, + `sum` decimal(19,9) NOT NULL, + `time` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `community_id` (`community_id`), + KEY `currency_id` (`currency_id`), + KEY `payer_user_id` (`payer_user_id`), + KEY `payee_user_id` (`payee_user_id`), + CONSTRAINT `transactions_community_id` FOREIGN KEY (`community_id`) REFERENCES `communities` (`id`), + CONSTRAINT `transactions_currency_id` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`), + CONSTRAINT `transactions_payer_user_id` FOREIGN KEY (`payer_user_id`) REFERENCES `users` (`id`), + CONSTRAINT `transactions_payee_user_id` FOREIGN KEY (`payee_user_id`) REFERENCES `users` (`id`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;