CREATE TABLE IF NOT EXISTS `device_groups` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL DEFAULT '', `desc` varchar(255) NOT NULL DEFAULT '',  `pattern` text,  PRIMARY KEY (`id`),  UNIQUE KEY `name` (`name`)) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `device_group_device` ( `device_group_id` int(10) unsigned NOT NULL, `device_id` int(10) unsigned NOT NULL, PRIMARY KEY (`device_group_id`,`device_id`),  KEY `device_group_device_device_group_id_index` (`device_group_id`),  KEY `device_group_device_device_id_index` (`device_id`), CONSTRAINT `device_group_device_device_group_id_foreign` FOREIGN KEY (`device_group_id`) REFERENCES `device_groups` (`id`) ON DELETE CASCADE,  CONSTRAINT `device_group_device_device_id_foreign` FOREIGN KEY (`device_id`) REFERENCES `devices` (`device_id`) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=latin1;
