[icinga-checkins] icinga.org: icinga-web/r1.7: * Fixed pgsql sequence not being updated correctly on db creation

git at icinga.org git at icinga.org
Mon Jun 18 13:30:21 CEST 2012


Module: icinga-web
Branch: r1.7
Commit: 67aaf1995f79d7205dce8fcb0c487d859a8d2459
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=67aaf1995f79d7205dce8fcb0c487d859a8d2459

Author: Jannis Mosshammer <jannis.mosshammer at netways.de>
Date:   Wed May 16 12:28:31 2012 +0200

* Fixed pgsql sequence not being updated correctly on db creation

---

 .../models/generated/BaseNsmPrincipalTarget.php    |    2 +-
 .../database/models/generated/BaseNsmTarget.php    |    2 +-
 etc/schema/pgsql.sql                               |   16 +++++++++++-----
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/app/modules/AppKit/lib/database/models/generated/BaseNsmPrincipalTarget.php b/app/modules/AppKit/lib/database/models/generated/BaseNsmPrincipalTarget.php
index 178cdf3..c2259b5 100644
--- a/app/modules/AppKit/lib/database/models/generated/BaseNsmPrincipalTarget.php
+++ b/app/modules/AppKit/lib/database/models/generated/BaseNsmPrincipalTarget.php
@@ -115,6 +115,6 @@ abstract class BaseNsmPrincipalTarget extends Doctrine_Record {
     }
 
     public static function getPgsqlSequenceOffsets() {
-        return array("nsm_principal_target_pt_id_seq" => 9);
+        return array("nsm_principal_target_pt_id_seq" => 13);
     }
 }
diff --git a/app/modules/AppKit/lib/database/models/generated/BaseNsmTarget.php b/app/modules/AppKit/lib/database/models/generated/BaseNsmTarget.php
index 0ea2299..5947f13 100644
--- a/app/modules/AppKit/lib/database/models/generated/BaseNsmTarget.php
+++ b/app/modules/AppKit/lib/database/models/generated/BaseNsmTarget.php
@@ -125,6 +125,6 @@ abstract class BaseNsmTarget extends Doctrine_Record {
     }
 
     public static function getPgsqlSequenceOffsets() {
-        return array("nsm_target_target_id_seq" => 20);
+        return array("nsm_target_target_id_seq" => 21);
     }
 }
diff --git a/etc/schema/pgsql.sql b/etc/schema/pgsql.sql
index 64066df..24c7257 100644
--- a/etc/schema/pgsql.sql
+++ b/etc/schema/pgsql.sql
@@ -47,7 +47,7 @@ ALTER TABLE nsm_user_role ADD CONSTRAINT nsm_user_role_usro_role_id_nsm_role_rol
 
 /*          Initial data import              */
  
-INSERT INTO nsm_user (user_id,user_account,user_name,user_firstname,user_lastname,user_password,user_salt,user_authsrc,user_email,user_disabled) VALUES ('1','0','root','Enoch','Root','42bc5093863dce8c150387a5bb7e3061cf3ea67d2cf1779671e1b0f435e953a1','0c099ae4627b144f3a7eaa763ba43b10fd5d1caa8738a98f11bb973bebc52ccd','internal','root at localhost.local','0');
+INSERT INTO nsm_user (user_id,user_account,user_name,user_firstname,user_lastname,user_password,user_salt,user_authsrc,user_email,user_disabled,user_created,user_modified) VALUES ('1','0','root','Enoch','Root','42bc5093863dce8c150387a5bb7e3061cf3ea67d2cf1779671e1b0f435e953a1','0c099ae4627b144f3a7eaa763ba43b10fd5d1caa8738a98f11bb973bebc52ccd','internal','root at localhost.local','0',NOW(),NOW());
 INSERT INTO nsm_db_version VALUES ('1','icinga-web/v1.7.0', NOW(), NOW());
 INSERT INTO nsm_target (target_id,target_name,target_description,target_class,target_type) VALUES ('1','IcingaHostgroup','Limit data access to specific hostgroups','IcingaDataHostgroupPrincipalTarget','icinga');
 INSERT INTO nsm_target (target_id,target_name,target_description,target_class,target_type) VALUES ('2','IcingaServicegroup','Limit data access to specific servicegroups','IcingaDataServicegroupPrincipalTarget','icinga');
@@ -69,10 +69,10 @@ INSERT INTO nsm_target (target_id,target_name,target_description,target_class,ta
 INSERT INTO nsm_target (target_id,target_name,target_description,target_class,target_type) VALUES ('18','icinga.control.admin','Allow user to administrate the icinga process','','credential');
 INSERT INTO nsm_target (target_id,target_name,target_description,target_class,target_type) VALUES ('19','IcingaCommandRestrictions','Disable critical commands for this user','IcingaDataCommandRestrictionPrincipalTarget','icinga');
 INSERT INTO nsm_target (target_id,target_name,target_description,target_class,target_type) VALUES ('20','icinga.cronk.custom','Allow user to create and modify custom cronks','','credential');
-INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled) VALUES ('1','icinga_user','The default representation of a ICINGA user','0');
-INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled) VALUES ('2','appkit_user','Appkit user test','0');
-INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled,role_parent) VALUES ('3','appkit_admin','AppKit admin','0','2');
-INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled) VALUES ('4','guest','Unauthorized Guest','0');
+INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled,role_created,role_modified) VALUES ('1','icinga_user','The default representation of a ICINGA user','0',NOW(),NOW());
+INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled,role_created,role_modified) VALUES ('2','appkit_user','Appkit user test','0',NOW(),NOW());
+INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled,role_parent,role_created,role_modified) VALUES ('3','appkit_admin','AppKit admin','0','2',NOW(),NOW());
+INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled,role_created,role_modified) VALUES ('4','guest','Unauthorized Guest','0',NOW(),NOW());
 INSERT INTO nsm_principal (principal_id,principal_user_id,principal_type,principal_disabled) VALUES ('1','1','user','0');
 INSERT INTO nsm_principal (principal_id,principal_role_id,principal_type,principal_disabled) VALUES ('2','2','role','0');
 INSERT INTO nsm_principal (principal_id,principal_role_id,principal_type,principal_disabled) VALUES ('3','3','role','0');
@@ -93,3 +93,9 @@ INSERT INTO nsm_principal_target (pt_id,pt_principal_id,pt_target_id) VALUES ('1
 INSERT INTO nsm_user_role (usro_user_id,usro_role_id) VALUES ('1','1');
 INSERT INTO nsm_user_role (usro_user_id,usro_role_id) VALUES ('1','2');
 INSERT INTO nsm_user_role (usro_user_id,usro_role_id) VALUES ('1','3');
+
+/* Updated sequences, otherwise insertions might fail with a unique constraint violation error */
+SELECT setval('nsm_principal_target_pt_id_seq','21');
+SELECT setval('nsm_principal_principal_id_seq','6');
+SELECT setval('nsm_user_user_id_seq','2');
+SELECT setval('nsm_role_role_id_seq','5');





More information about the icinga-checkins mailing list