From 2237bbd6ec3aeaf0880712a3af1f21fceda54d9b Mon Sep 17 00:00:00 2001 From: a2-imeri <Alfret2.imeri@live.uwe.ac.uk> Date: Tue, 2 Jul 2024 16:23:03 +0100 Subject: [PATCH] Download Video Functionality --- MisplaceAI/process_misplaced_manager/urls.py | 4 +- MisplaceAI/process_misplaced_manager/views.py | 21 ++ .../src/pages/Video/VideoDetectionPage.js | 38 +- .../services/processMisplacedManagerApi.js | 11 + schema.sql | 349 ------------------ 5 files changed, 64 insertions(+), 359 deletions(-) delete mode 100644 schema.sql diff --git a/MisplaceAI/process_misplaced_manager/urls.py b/MisplaceAI/process_misplaced_manager/urls.py index 5d28647..4da3c06 100644 --- a/MisplaceAI/process_misplaced_manager/urls.py +++ b/MisplaceAI/process_misplaced_manager/urls.py @@ -4,7 +4,7 @@ from rest_framework.routers import DefaultRouter from .views import ( UploadedImageViewSet, UploadedVideoViewSet, normal_detection, - display_results, display_video_results,upload_video, download_image, delete_image,delete_video + display_results, display_video_results,upload_video, download_image, delete_image,delete_video,download_media ) router = DefaultRouter() @@ -16,12 +16,12 @@ app_name = 'process_misplaced_manager' urlpatterns = [ path('', include(router.urls)), path('normal-detection/', normal_detection, name='normal_detection'), - # path('segmentation-detection/', segmentation_detection, name='segmentation_detection'), path('upload-video/', upload_video, name='upload_video'), path('video-results/<int:video_id>/', display_video_results, name='display_video_results'), path('display-results/<int:image_id>/', display_results, name='display_results'), path('download/<path:file_path>/', download_image, name='download_image'), path('delete-image/<str:image_name>/', delete_image, name='delete_image_by_name'), path('delete-video/<str:video_name>/', delete_video, name='delete_video'), + path('download_video/<str:file_path>/', download_media, name='download_media'), ] diff --git a/MisplaceAI/process_misplaced_manager/views.py b/MisplaceAI/process_misplaced_manager/views.py index 96ed406..c826456 100644 --- a/MisplaceAI/process_misplaced_manager/views.py +++ b/MisplaceAI/process_misplaced_manager/views.py @@ -319,3 +319,24 @@ def download_image(request, file_path): raise Http404 + + + +@api_view(['GET']) +# @permission_classes([IsAuthenticated]) +def download_media(request, file_path): + # Determine if the file is in the 'videos' directory + video_path = os.path.join(settings.MEDIA_ROOT, 'videos', file_path) + if os.path.exists(video_path): + file_path = video_path + else: + # Otherwise, treat it as if it's in the root of MEDIA_ROOT (for images) + file_path = os.path.join(settings.MEDIA_ROOT, file_path) + + if os.path.exists(file_path): + with open(file_path, 'rb') as f: + response = HttpResponse(f.read(), content_type="application/force-download") + response['Content-Disposition'] = f'attachment; filename="{os.path.basename(file_path)}"' + return response + else: + raise Http404 diff --git a/frontend/src/pages/Video/VideoDetectionPage.js b/frontend/src/pages/Video/VideoDetectionPage.js index 35ae564..338fa7c 100644 --- a/frontend/src/pages/Video/VideoDetectionPage.js +++ b/frontend/src/pages/Video/VideoDetectionPage.js @@ -2,12 +2,13 @@ import React, { useState, useEffect } from 'react'; import { useNavigate, useLocation } from 'react-router-dom'; -import { uploadVideo, getVideoResults, deleteVideo } from '../../services/processMisplacedManagerApi'; +import { uploadVideo, getVideoResults, deleteVideo, downloadMedia } from '../../services/processMisplacedManagerApi'; import '../../styles/main.css'; import LoadingIndicator from '../../components/detection/LoadingIndicator'; import DetectionResults from '../../components/detection/DetectionResults'; import UploadForm from '../../components/detection/UploadForm'; import DetectionContainer from '../../components/detection/DetectionContainer'; +import { Button } from 'react-bootstrap'; const VideoDetectionPage = () => { const [videoFile, setVideoFile] = useState(null); @@ -21,8 +22,8 @@ const VideoDetectionPage = () => { const [isDeleting, setIsDeleting] = useState(false); useEffect(() => { - const handleUnload = async () => { - if (annotatedVideoName && !isDeleting) { + const handleBeforeUnload = async () => { + if (!isDeleting && annotatedVideoName) { setIsDeleting(true); console.log('Navigation event detected:'); console.log('Annotated video name detected:', annotatedVideoName); @@ -36,19 +37,19 @@ const VideoDetectionPage = () => { } }; - window.addEventListener('beforeunload', handleUnload); + window.addEventListener('beforeunload', handleBeforeUnload); return () => { - window.removeEventListener('beforeunload', handleUnload); + window.removeEventListener('beforeunload', handleBeforeUnload); + handleBeforeUnload(); }; }, [annotatedVideoName, isDeleting]); useEffect(() => { const handleRouteChange = async () => { - if (annotatedVideoName && !isDeleting) { + if (!isDeleting && annotatedVideoName) { setIsDeleting(true); console.log('Route change detected:'); - console.log('Annotated video name detected:', annotatedVideoName); try { const response = await deleteVideo(annotatedVideoName); console.log('Delete video response:', response); @@ -62,7 +63,7 @@ const VideoDetectionPage = () => { return () => { handleRouteChange(); }; - }, [annotatedVideoName, isDeleting, location]); + }, [annotatedVideoName, location, isDeleting]); const handleFileChange = (event) => { setVideoFile(event.target.files[0]); @@ -104,6 +105,22 @@ const VideoDetectionPage = () => { } }; + const handleDownload = async () => { + try { + const filePath = result.output_video_url.split('/').pop(); + const response = await downloadMedia(filePath); + const url = window.URL.createObjectURL(new Blob([response.data])); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', `detection_result${result.output_video_url.substring(result.output_video_url.lastIndexOf('.'))}`); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } catch (error) { + console.error('Error downloading video:', error); + } + }; + return ( <DetectionContainer title="Upload Video for Misplaced Items Detection"> <LoadingIndicator isLoading={isLoading} message="Your video is being processed, please wait..." /> @@ -119,6 +136,11 @@ const VideoDetectionPage = () => { )} <DetectionResults result={result} /> <div className="text-center mt-4"> + {result && result.output_video_url && ( + <Button onClick={handleDownload} className="btn btn-success mr-2"> + Download Video + </Button> + )} <a href="/detection-options" className="btn btn-link"> <i className="fas fa-arrow-left"></i> Back to Detection Options </a> diff --git a/frontend/src/services/processMisplacedManagerApi.js b/frontend/src/services/processMisplacedManagerApi.js index 89d9029..6807735 100644 --- a/frontend/src/services/processMisplacedManagerApi.js +++ b/frontend/src/services/processMisplacedManagerApi.js @@ -156,3 +156,14 @@ export const deleteVideo = async (videoName) => { } }; +export const downloadMedia = async (filePath) => { + try { + const response = await api.get(`/api/process_misplaced_manager/download_video/${filePath}/`, { + responseType: 'blob' // Important for handling file downloads + }); + return response; + } catch (error) { + console.error('Error downloading media:', error); + throw error; + } +}; \ No newline at end of file diff --git a/schema.sql b/schema.sql deleted file mode 100644 index 549fdf1..0000000 --- a/schema.sql +++ /dev/null @@ -1,349 +0,0 @@ --- MySQL dump 10.13 Distrib 5.7.44, for Linux (x86_64) --- --- Host: localhost Database: misplaceai --- ------------------------------------------------------ --- Server version 5.7.44 - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Table structure for table `auth_group` --- - -DROP TABLE IF EXISTS `auth_group`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `auth_group` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(150) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `auth_group_permissions` --- - -DROP TABLE IF EXISTS `auth_group_permissions`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `auth_group_permissions` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `group_id` int(11) NOT NULL, - `permission_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `auth_group_permissions_group_id_permission_id_0cd325b0_uniq` (`group_id`,`permission_id`), - KEY `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` (`permission_id`), - CONSTRAINT `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), - CONSTRAINT `auth_group_permissions_group_id_b120cbf9_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `auth_permission` --- - -DROP TABLE IF EXISTS `auth_permission`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `auth_permission` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL, - `content_type_id` int(11) NOT NULL, - `codename` varchar(100) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `auth_permission_content_type_id_codename_01ab375a_uniq` (`content_type_id`,`codename`), - CONSTRAINT `auth_permission_content_type_id_2f476e4b_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `auth_user` --- - -DROP TABLE IF EXISTS `auth_user`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `auth_user` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `password` varchar(128) NOT NULL, - `last_login` datetime(6) DEFAULT NULL, - `is_superuser` tinyint(1) NOT NULL, - `username` varchar(150) NOT NULL, - `first_name` varchar(150) NOT NULL, - `last_name` varchar(150) NOT NULL, - `email` varchar(254) NOT NULL, - `is_staff` tinyint(1) NOT NULL, - `is_active` tinyint(1) NOT NULL, - `date_joined` datetime(6) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `username` (`username`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `auth_user_groups` --- - -DROP TABLE IF EXISTS `auth_user_groups`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `auth_user_groups` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `user_id` int(11) NOT NULL, - `group_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `auth_user_groups_user_id_group_id_94350c0c_uniq` (`user_id`,`group_id`), - KEY `auth_user_groups_group_id_97559544_fk_auth_group_id` (`group_id`), - CONSTRAINT `auth_user_groups_group_id_97559544_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`), - CONSTRAINT `auth_user_groups_user_id_6a12ed8b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `auth_user_user_permissions` --- - -DROP TABLE IF EXISTS `auth_user_user_permissions`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `auth_user_user_permissions` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `user_id` int(11) NOT NULL, - `permission_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `auth_user_user_permissions_user_id_permission_id_14a6b632_uniq` (`user_id`,`permission_id`), - KEY `auth_user_user_permi_permission_id_1fbb5f2c_fk_auth_perm` (`permission_id`), - CONSTRAINT `auth_user_user_permi_permission_id_1fbb5f2c_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), - CONSTRAINT `auth_user_user_permissions_user_id_a95ead1b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `django_admin_log` --- - -DROP TABLE IF EXISTS `django_admin_log`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `django_admin_log` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `action_time` datetime(6) NOT NULL, - `object_id` longtext, - `object_repr` varchar(200) NOT NULL, - `action_flag` smallint(5) unsigned NOT NULL, - `change_message` longtext NOT NULL, - `content_type_id` int(11) DEFAULT NULL, - `user_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `django_admin_log_content_type_id_c4bce8eb_fk_django_co` (`content_type_id`), - KEY `django_admin_log_user_id_c564eba6_fk_auth_user_id` (`user_id`), - CONSTRAINT `django_admin_log_content_type_id_c4bce8eb_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), - CONSTRAINT `django_admin_log_user_id_c564eba6_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `django_content_type` --- - -DROP TABLE IF EXISTS `django_content_type`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `django_content_type` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `app_label` varchar(100) NOT NULL, - `model` varchar(100) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `django_content_type_app_label_model_76bd3d3b_uniq` (`app_label`,`model`) -) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `django_migrations` --- - -DROP TABLE IF EXISTS `django_migrations`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `django_migrations` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `app` varchar(255) NOT NULL, - `name` varchar(255) NOT NULL, - `applied` datetime(6) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `django_session` --- - -DROP TABLE IF EXISTS `django_session`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `django_session` ( - `session_key` varchar(40) NOT NULL, - `session_data` longtext NOT NULL, - `expire_date` datetime(6) NOT NULL, - PRIMARY KEY (`session_key`), - KEY `django_session_expire_date_a5c62663` (`expire_date`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `placement_rules_placementrule` --- - -DROP TABLE IF EXISTS `placement_rules_placementrule`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `placement_rules_placementrule` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `object_name` varchar(100) NOT NULL, - `allowed_locations` json NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `process_misplaced_manager_uploadedimage` --- - -DROP TABLE IF EXISTS `process_misplaced_manager_uploadedimage`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `process_misplaced_manager_uploadedimage` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `image` varchar(100) NOT NULL, - `uploaded_at` datetime(6) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `process_misplaced_manager_uploadedvideo` --- - -DROP TABLE IF EXISTS `process_misplaced_manager_uploadedvideo`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `process_misplaced_manager_uploadedvideo` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `video` varchar(100) NOT NULL, - `uploaded_at` datetime(6) NOT NULL, - `user_id` int(11) NOT NULL, - `user_video_frame_preference_id` bigint(20) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `process_misplaced_ma_user_id_f01b3449_fk_auth_user` (`user_id`), - KEY `process_misplaced_ma_user_video_frame_pre_9a42197b_fk_process_m` (`user_video_frame_preference_id`), - CONSTRAINT `process_misplaced_ma_user_id_f01b3449_fk_auth_user` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), - CONSTRAINT `process_misplaced_ma_user_video_frame_pre_9a42197b_fk_process_m` FOREIGN KEY (`user_video_frame_preference_id`) REFERENCES `process_misplaced_manager_uservideoframepreference` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `process_misplaced_manager_uservideoframepreference` --- - -DROP TABLE IF EXISTS `process_misplaced_manager_uservideoframepreference`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `process_misplaced_manager_uservideoframepreference` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `frame_interval` int(11) NOT NULL, - `user_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `user_id` (`user_id`), - CONSTRAINT `process_misplaced_ma_user_id_c4fd8017_fk_auth_user` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `rules_item` --- - -DROP TABLE IF EXISTS `rules_item`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `rules_item` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `rules_location` --- - -DROP TABLE IF EXISTS `rules_location`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `rules_location` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `rules_rule` --- - -DROP TABLE IF EXISTS `rules_rule`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `rules_rule` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `item_id` bigint(20) NOT NULL, - `user_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `rules_rule_item_id_e7fc9070_fk_rules_item_id` (`item_id`), - KEY `rules_rule_user_id_a3576cd9_fk_auth_user_id` (`user_id`), - CONSTRAINT `rules_rule_item_id_e7fc9070_fk_rules_item_id` FOREIGN KEY (`item_id`) REFERENCES `rules_item` (`id`), - CONSTRAINT `rules_rule_user_id_a3576cd9_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `rules_rule_locations` --- - -DROP TABLE IF EXISTS `rules_rule_locations`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `rules_rule_locations` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `rule_id` bigint(20) NOT NULL, - `location_id` bigint(20) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `rules_rule_locations_rule_id_location_id_aeeed3a6_uniq` (`rule_id`,`location_id`), - KEY `rules_rule_locations_location_id_71e247a5_fk_rules_location_id` (`location_id`), - CONSTRAINT `rules_rule_locations_location_id_71e247a5_fk_rules_location_id` FOREIGN KEY (`location_id`) REFERENCES `rules_location` (`id`), - CONSTRAINT `rules_rule_locations_rule_id_2a81ba57_fk_rules_rule_id` FOREIGN KEY (`rule_id`) REFERENCES `rules_rule` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=63 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- Dump completed on 2024-07-01 16:22:46 -- GitLab