-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathurl.sql
More file actions
125 lines (102 loc) · 3.59 KB
/
Copy pathurl.sql
File metadata and controls
125 lines (102 loc) · 3.59 KB
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
-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 27, 2026 at 03:30 PM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.2.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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: `url`
--
-- --------------------------------------------------------
--
-- Table structure for table `urls`
--
CREATE TABLE `urls` (
`id` int(11) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`long_url` text NOT NULL,
`short_code` varchar(10) NOT NULL,
`name` varchar(100) DEFAULT NULL,
`clicks` int(11) DEFAULT 0,
`expires_at` datetime DEFAULT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
--
-- Dumping data for table `urls`
--
INSERT INTO `urls` (`id`, `user_id`, `long_url`, `short_code`, `clicks`, `expires_at`, `created_at`) VALUES
(1, 1, 'https://github.com/urls/url-shortener-php', '8BmyZr', 6, NULL, '2026-01-10 19:03:40'),
(2, NULL, 'https://github.com/urls/url-shortener-php', '6uMS2p', 0, '2026-01-17 19:04:02', '2026-01-10 19:04:02'),
(3, NULL, 'https://www.trae.ai/account-setting?user_id=7593799062131115024&username=bookandbits#usage', 'L9LwRb', 0, '2026-01-17 19:10:54', '2026-01-10 19:10:54'),
(4, NULL, 'https://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_colspan2', 'HBn6zN', 2, '2026-01-20 17:52:53', '2026-01-13 17:52:53'),
(5, 1, 'https://cdn.mos.cms.futurecdn.net/v2/t:0,l:420,cw:1080,ch:1080,q:80,w:1080/TVR7E3Kuzg2iRhKkjZPeWk.jpg', 'xEyi2S', 17, NULL, '2026-01-26 14:35:08');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(50) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(255) NOT NULL,
`is_verified` tinyint(1) DEFAULT 0,
`otp` varchar(6) DEFAULT NULL,
`otp_expiry` datetime DEFAULT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `email`, `password`, `is_verified`, `otp`, `otp_expiry`, `created_at`) VALUES
(1, 'user', 'user@gmail.com', '$2y$10$A5TfPx8w3LlfAjJ21QslW.Q2v0MJ4nsP8nCG8I5e5QBFLBvH8ZV6q', 1, NULL, NULL, '2026-01-10 18:50:31');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `urls`
--
ALTER TABLE `urls`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `short_code` (`short_code`),
ADD KEY `user_id` (`user_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`),
ADD UNIQUE KEY `email` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `urls`
--
ALTER TABLE `urls`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `urls`
--
ALTER TABLE `urls`
ADD CONSTRAINT `urls_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
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 */;