added DB table object_access_snapshot
authorVictor Kirhenshtein <victor@netxms.org>
Mon, 8 May 2017 14:12:48 +0000 (17:12 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Mon, 8 May 2017 14:12:48 +0000 (17:12 +0300)
include/netxmsdb.h
sql/schema.in
src/server/tools/nxdbmgr/upgrade.cpp

index c0aa872..46c0b43 100644 (file)
@@ -23,6 +23,6 @@
 #ifndef _netxmsdb_h
 #define _netxmsdb_h
 
-#define DB_FORMAT_VERSION   450
+#define DB_FORMAT_VERSION   451
 
 #endif
index 3d3f5a0..07220f8 100644 (file)
@@ -1707,3 +1707,14 @@ CREATE TABLE port_layouts
    layout_data varchar(4000) null,
    PRIMARY KEY(device_oid)
 ) TABLE_TYPE;
+
+/**
+ * Snapshot for object access rights
+ */
+CREATE TABLE object_access_snapshot
+(
+   user_id integer not null,
+   object_id integer not null,
+   access_rights integer not null,
+   PRIMARY KEY(user_id,object_id)
+) TABLE_TYPE;
index b78e681..0a3d04f 100644 (file)
@@ -747,6 +747,22 @@ static bool SetSchemaVersion(int version)
 }
 
 /**
+ * Upgrade from V450 to V451
+ */
+static BOOL H_UpgradeFromV450(int currVersion, int newVersion)
+{
+   CHK_EXEC(CreateTable(
+      _T("CREATE TABLE object_access_snapshot (")
+      _T("  user_id integer not null,")
+      _T("  object_id integer not null,")
+      _T("  access_rights integer not null,")
+      _T("PRIMARY KEY(user_id,object_id))")));
+
+   CHK_EXEC(SetSchemaVersion(451));
+   return TRUE;
+}
+
+/**
  * Upgrade from V449 to V450
  */
 static BOOL H_UpgradeFromV449(int currVersion, int newVersion)
@@ -11724,6 +11740,7 @@ static struct
    { 447, 448, H_UpgradeFromV447 },
    { 448, 449, H_UpgradeFromV448 },
    { 449, 450, H_UpgradeFromV449 },
+   { 450, 451, H_UpgradeFromV450 },
    { 0, 0, NULL }
 };