1 | --
|
---|
2 | -- Table structure for table `message`
|
---|
3 | --
|
---|
4 |
|
---|
5 | CREATE TABLE IF NOT EXISTS `message` (
|
---|
6 | `id` int(11) NOT NULL,
|
---|
7 | `from_id` int(11) NOT NULL,
|
---|
8 | `to_id` int(11) NOT NULL,
|
---|
9 | `body` text NOT NULL,
|
---|
10 | `in` int(11) NOT NULL,
|
---|
11 | PRIMARY KEY (`id`),
|
---|
12 | KEY `from_id` (`from_id`),
|
---|
13 | KEY `to_id` (`to_id`)
|
---|
14 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
---|
15 |
|
---|
16 | -- --------------------------------------------------------
|
---|
17 |
|
---|
18 | --
|
---|
19 | -- Table structure for table `people`
|
---|
20 | --
|
---|
21 |
|
---|
22 | CREATE TABLE IF NOT EXISTS `people` (
|
---|
23 | `id` int(11) NOT NULL,
|
---|
24 | `name` varchar(255) NOT NULL,
|
---|
25 | PRIMARY KEY (`id`)
|
---|
26 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
---|
27 |
|
---|
28 | --
|
---|
29 | -- Constraints for dumped tables
|
---|
30 | --
|
---|
31 |
|
---|
32 | --
|
---|
33 | -- Constraints for table `message`
|
---|
34 | --
|
---|
35 | ALTER TABLE `message`
|
---|
36 | ADD CONSTRAINT `message_from_id_fkey` FOREIGN KEY (`from_id`) REFERENCES `people` (`id`) ON DELETE CASCADE,
|
---|
37 | ADD CONSTRAINT `message_to_id_fkey` FOREIGN KEY (`to_id`) REFERENCES `people` (`id`) ON DELETE CASCADE;
|
---|