From e3c5d3567458443fbf034709806108753a0201c1 Mon Sep 17 00:00:00 2001 From: stan Date: Wed, 13 Oct 2004 10:58:37 +0000 Subject: [PATCH] Added Groups table and ratonalised some name columns. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1155 e3e1d417-86f3-4887-817a-d78f3d33393f --- db/zmalter-1.19.5.sql | 16 ++++++++++++++++ db/zmschema.sql.z | 24 ++++++++++++++++++------ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/db/zmalter-1.19.5.sql b/db/zmalter-1.19.5.sql index f2d4256f4..8de317d00 100644 --- a/db/zmalter-1.19.5.sql +++ b/db/zmalter-1.19.5.sql @@ -1,10 +1,26 @@ -- -- This updates a 1.19.5 database to 1.19.6 -- +-- Create the Groups table +-- +CREATE TABLE Groups ( + Id int(10) unsigned NOT NULL auto_increment, + Name varchar(64) NOT NULL, + MonitorIds tinytext NOT NULL, + PRIMARY KEY (Id) +) TYPE=MyISAM; +-- -- Add a new index to the Events table -- alter table Events add index (Frames); -- +-- Rationalise some of the name columns +alter table Events modify column Name varchar(64) not null; +alter table Filters modify column Name varchar(64) not null; +alter table Monitors modify column Name varchar(64) not null; +alter table States modify column Name varchar(64) not null; +alter table Zones modify column Name varchar(64) not null; +-- -- These are optional, but we might as well do it now -- optimize table Frames; diff --git a/db/zmschema.sql.z b/db/zmschema.sql.z index 30689e947..e251d8d16 100644 --- a/db/zmschema.sql.z +++ b/db/zmschema.sql.z @@ -35,7 +35,7 @@ CREATE TABLE Config ( CREATE TABLE Events ( Id int(10) unsigned NOT NULL auto_increment, MonitorId int(10) unsigned NOT NULL default '0', - Name tinytext NOT NULL, + Name varchar(64) NOT NULL, StartTime datetime default NULL, EndTime datetime default NULL, Length decimal(10,2) NOT NULL default '0.00', @@ -55,7 +55,8 @@ CREATE TABLE Events ( KEY Id (Id,MonitorId), KEY MonitorId (MonitorId), KEY StartTime (StartTime), - KEY Frames (Frames) + KEY Frames (Frames), + KEY Archived (Archived) ) TYPE=MyISAM; -- @@ -63,7 +64,7 @@ CREATE TABLE Events ( -- CREATE TABLE Filters ( - Name varchar(64) NOT NULL default '', + Name varchar(64) NOT NULL, Query text NOT NULL, AutoArchive tinyint(3) unsigned NOT NULL default '0', AutoDelete tinyint(3) unsigned NOT NULL default '0', @@ -91,13 +92,24 @@ CREATE TABLE Frames ( KEY EventId (EventId) ) TYPE=MyISAM; +-- +-- Table structure for table `Groups` +-- + +CREATE TABLE Groups ( + Id int(10) unsigned NOT NULL auto_increment, + Name varchar(64) NOT NULL, + MonitorIds tinytext NOT NULL, + PRIMARY KEY (Id) +) TYPE=MyISAM; + -- -- Table structure for table `Monitors` -- CREATE TABLE Monitors ( Id int(10) unsigned NOT NULL auto_increment, - Name tinytext NOT NULL, + Name varchar(64) NOT NULL, Type enum('Local','Remote') NOT NULL default 'Local', Function enum('None','Monitor','Modect','Record','Mocord') NOT NULL default 'Monitor', RunMode enum('Continuous','Triggered') NOT NULL default 'Continuous', @@ -138,7 +150,7 @@ CREATE TABLE Monitors ( -- CREATE TABLE States ( - Name varchar(32) NOT NULL default '', + Name varchar(64) NOT NULL, Definition tinytext NOT NULL, PRIMARY KEY (Name) ) TYPE=MyISAM; @@ -207,7 +219,7 @@ CREATE TABLE Users ( CREATE TABLE Zones ( Id int(10) unsigned NOT NULL auto_increment, MonitorId int(10) unsigned NOT NULL default '0', - Name tinytext NOT NULL, + Name varchar(64) NOT NULL default '', Type enum('Active','Inclusive','Exclusive','Preclusive','Inactive') NOT NULL default 'Active', Units enum('Pixels','Percent') NOT NULL default 'Pixels', LoX smallint(5) unsigned NOT NULL default '0',