Added Groups table and ratonalised some name columns.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1155 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2004-10-13 10:58:37 +00:00
parent 25e99bd4e8
commit e3c5d35674
2 changed files with 34 additions and 6 deletions

View File

@ -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;

View File

@ -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',