-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdb.sql
130 lines (105 loc) · 2.97 KB
/
db.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
-- phpMyAdmin SQL Dump
-- version 4.9.7deb1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Jan 13, 2021 at 03:29 PM
-- Server version: 8.0.22-0ubuntu0.20.10.2
-- PHP Version: 7.4.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!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 utf8mb4 */;
--
-- Database: `iplogger`
--
CREATE DATABASE IF NOT EXISTS `iplogger` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `iplogger`;
-- --------------------------------------------------------
--
-- Table structure for table `log`
--
CREATE TABLE `log` (
`id` int NOT NULL,
`ip` varchar(255) NOT NULL,
`user_agent` varchar(255) NOT NULL,
`clicked_at` datetime NOT NULL,
`tracker_id` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- --------------------------------------------------------
--
-- Table structure for table `short_url`
--
CREATE TABLE `short_url` (
`id` int NOT NULL,
`url` varchar(255) NOT NULL,
`code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`tracker_id` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- --------------------------------------------------------
--
-- Table structure for table `tracker`
--
CREATE TABLE `tracker` (
`id` int NOT NULL,
`code` varchar(255) COLLATE utf8mb4_general_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `log`
--
ALTER TABLE `log`
ADD PRIMARY KEY (`id`),
ADD KEY `tracker_id` (`tracker_id`);
--
-- Indexes for table `short_url`
--
ALTER TABLE `short_url`
ADD PRIMARY KEY (`id`),
ADD KEY `tracker_id` (`tracker_id`);
--
-- Indexes for table `tracker`
--
ALTER TABLE `tracker`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `log`
--
ALTER TABLE `log`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `short_url`
--
ALTER TABLE `short_url`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tracker`
--
ALTER TABLE `tracker`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `log`
--
ALTER TABLE `log`
ADD CONSTRAINT `log_ibfk_1` FOREIGN KEY (`tracker_id`) REFERENCES `tracker` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
--
-- Constraints for table `short_url`
--
ALTER TABLE `short_url`
ADD CONSTRAINT `short_url_ibfk_1` FOREIGN KEY (`tracker_id`) REFERENCES `tracker` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
COMMIT;
/*!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 */;