Skip to content

Channels Table

Bhavesh Ramburn edited this page Mar 21, 2019 · 2 revisions

The channels Table holds the sub-category/containers that holds the messages. Each group can have many channels but a channel can only belong to one group. This is a 1 to Many relationship from group to channels.

Permissions can be placed per channel but we'll look into this via the join tables in this project.

  • id - auto increment int 11 char long
  • name - 128 varchar
  • description - 256 varchar
  • groupid - from the groups table's id

CREATE TABLE `channels` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(128) NOT NULL,
  `description` varchar(256) DEFAULT NULL,
  `groupid` int(11) unsigned NOT NULL,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `group2channel` (`groupid`),
  CONSTRAINT `group2channel` FOREIGN KEY (`groupid`) REFERENCES `group` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


Clone this wiki locally