From dd217d6d598076b95e94e0dbb0d1f2951267df4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Fri, 26 May 2023 16:36:51 +0200 Subject: [PATCH] RVRNEXT-11 add migrations for events --- .../structure/20230526_1551_events.sql | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 database/migrations/structure/20230526_1551_events.sql diff --git a/database/migrations/structure/20230526_1551_events.sql b/database/migrations/structure/20230526_1551_events.sql new file mode 100644 index 0000000..aae1234 --- /dev/null +++ b/database/migrations/structure/20230526_1551_events.sql @@ -0,0 +1,18 @@ +CREATE TABLE `events` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `slug` varchar(255) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL, + `community_id` int(10) unsigned NOT NULL, + `start` timestamp NOT NULL DEFAULT current_timestamp(), + `end` timestamp NOT NULL DEFAULT current_timestamp(), + `title` varchar(255) NOT NULL, + `description` text NOT NULL, + PRIMARY KEY (`id`), + KEY `community_id` (`community_id`), + UNIQUE KEY `slug` (`slug`), + CONSTRAINT `events_community_id` FOREIGN KEY (`community_id`) REFERENCES `communities` (`id`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4; + +ALTER TABLE `transactions` +ADD `event_id` int(10) unsigned NULL, +ADD KEY `event_id` (`event_id`) AFTER `community_id`, +ADD CONSTRAINT `transactions_event_id` FOREIGN KEY (`event_id`) REFERENCES `events` (`id`);