Fixed error with System Access Rights for LDAP users
[public/netxms.git] / sql / metadata.in
CommitLineData
28f5b9a4
VK
1/*
2** Metadata
3**
4** ex: syntax=sql
5*/
6
7INSERT INTO metadata (var_name,var_value)
8 VALUES ('SchemaVersion',DB_FORMAT_VERSION);
9INSERT INTO metadata (var_name,var_value)
10 VALUES ('Syntax',DB_SYNTAX);
d6124fa0 11
28f5b9a4 12INSERT INTO metadata (var_name,var_value)
50da2d20 13 VALUES ('IDataTableCreationCommand','CREATE TABLE idata_%d (item_id integer not null,idata_timestamp integer not null,idata_value varchar(255) null)');
4161f620 14#if defined(DB_POSTGRESQL)
28f5b9a4 15INSERT INTO metadata (var_name,var_value)
4161f620 16 VALUES ('IDataIndexCreationCommand_0','CREATE INDEX idx_idata_%d_timestamp_id ON idata_%d(idata_timestamp,item_id)');
28f5b9a4
VK
17#elif defined(DB_MSSQL)
18INSERT INTO metadata (var_name,var_value)
4161f620
VK
19 VALUES ('IDataIndexCreationCommand_0','CREATE CLUSTERED INDEX idx_idata_%d_id_timestamp ON idata_%d(item_id,idata_timestamp)');
20#else
21INSERT INTO metadata (var_name,var_value)
22 VALUES ('IDataIndexCreationCommand_0','CREATE INDEX idx_idata_%d_id_timestamp ON idata_%d(item_id,idata_timestamp)');
28f5b9a4 23#endif
d6124fa0
VK
24
25INSERT INTO metadata (var_name,var_value)
1d4f7890 26 VALUES ('TDataTableCreationCommand_0','CREATE TABLE tdata_%d (item_id integer not null,tdata_timestamp integer not null,record_id ' CONCAT SQL_INT64_TEXT CONCAT ' not null,UNIQUE(record_id))');
22aaa779 27INSERT INTO metadata (var_name,var_value)
67c7212f 28 VALUES ('TDataTableCreationCommand_1','CREATE TABLE tdata_records_%d (record_id ' CONCAT SQL_INT64_TEXT CONCAT ' not null,row_id ' CONCAT SQL_INT64_TEXT CONCAT ' not null,instance varchar(255) null,PRIMARY KEY(row_id),FOREIGN KEY (record_id) REFERENCES tdata_%d(record_id) ON DELETE CASCADE)');
22aaa779 29INSERT INTO metadata (var_name,var_value)
1d4f7890 30 VALUES ('TDataTableCreationCommand_2','CREATE TABLE tdata_rows_%d (row_id ' CONCAT SQL_INT64_TEXT CONCAT ' not null,column_id integer not null,value varchar(255) null,PRIMARY KEY(row_id,column_id),FOREIGN KEY (row_id) REFERENCES tdata_records_%d(row_id) ON DELETE CASCADE)');
d6124fa0
VK
31#if defined(DB_POSTGRESQL)
32INSERT INTO metadata (var_name,var_value)
33 VALUES ('TDataIndexCreationCommand_0','CREATE INDEX idx_tdata_%d_timestamp_id ON tdata_%d(tdata_timestamp,item_id)');
34#elif defined(DB_MSSQL)
35INSERT INTO metadata (var_name,var_value)
36 VALUES ('TDataIndexCreationCommand_0','CREATE CLUSTERED INDEX idx_tdata_%d_id_timestamp ON tdata_%d(item_id,tdata_timestamp)');
37#else
38INSERT INTO metadata (var_name,var_value)
39 VALUES ('TDataIndexCreationCommand_0','CREATE INDEX idx_tdata_%d_id_timestamp ON tdata_%d(item_id,tdata_timestamp)');
40#endif
22aaa779
VK
41INSERT INTO metadata (var_name,var_value)
42 VALUES ('TDataIndexCreationCommand_1','CREATE INDEX idx_tdata_rec_%d_instance ON tdata_records_%d(instance)');
a9f5aa55
VK
43INSERT INTO metadata (var_name,var_value)
44 VALUES ('TDataIndexCreationCommand_2','CREATE INDEX idx_tdata_rec_%d_id ON tdata_records_%d(record_id)');