-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_servers_tables.sql
More file actions
63 lines (49 loc) · 1.83 KB
/
Copy pathadd_servers_tables.sql
File metadata and controls
63 lines (49 loc) · 1.83 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
-- =====================================================
-- STRIMR Database Migration
-- Add servers and message tables
-- Run this if you already have the strimr database
-- =====================================================
USE `strimr`;
-- --------------------------------------------------------
--
-- Structure de la table `servers`
--
CREATE TABLE IF NOT EXISTS `servers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Données de démonstration pour `servers`
--
INSERT IGNORE INTO `servers` (`id`, `name`, `created_at`) VALUES
(1, 'General Chat', NOW()),
(2, 'Gaming', NOW()),
(3, 'Music', NOW());
-- --------------------------------------------------------
--
-- Structure de la table `message`
--
CREATE TABLE IF NOT EXISTS `message` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`server_id` int(11) NOT NULL,
`content` text NOT NULL,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `server_id` (`server_id`),
CONSTRAINT `message_ibfk_1` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Structure de la table `notifications`
--
CREATE TABLE IF NOT EXISTS `notifications` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`content` text NOT NULL,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- =====================================================
-- Migration complete!
-- =====================================================