[icinga-checkins] icinga.org: icinga-web/jmosshammer/default2: * Postgre support and more graceful db-setup process

git at icinga.org git at icinga.org
Fri May 28 13:41:53 CEST 2010


Module: icinga-web
Branch: jmosshammer/default2
Commit: 9f60e03de366e303d87ed8ce23fd64b716fbcdd7
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=9f60e03de366e303d87ed8ce23fd64b716fbcdd7

Author: jmosshammer <jannis.mosshammer at netways.de>
Date:   Fri May 28 13:41:26 2010 +0200

* Postgre support and more graceful db-setup process

---

 .../database/models/generated/BaseNsmPrincipal.php |    4 ++--
 .../lib/database/models/generated/BaseNsmRole.php  |    6 +++---
 etc/lib/dbInitializeTask.php                       |   12 +++++++-----
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/app/modules/AppKit/lib/database/models/generated/BaseNsmPrincipal.php b/app/modules/AppKit/lib/database/models/generated/BaseNsmPrincipal.php
index cf04a4f..e3e1535 100755
--- a/app/modules/AppKit/lib/database/models/generated/BaseNsmPrincipal.php
+++ b/app/modules/AppKit/lib/database/models/generated/BaseNsmPrincipal.php
@@ -70,8 +70,8 @@ abstract class BaseNsmPrincipal extends Doctrine_Record
              'autoincrement' => false,
              ));
              
-       $this->index('principal_user_id_ix', array('fields'=>array('principal_user_id')));
-       $this->index('principal_role_id_ix', array('fields'=>array('principal_role_id')));
+    //   $this->index('principal_user_id_ix', array('fields'=>array('principal_user_id')));
+    //   $this->index('principal_role_id_ix', array('fields'=>array('principal_role_id')));
     }
 
     public function setUp()
diff --git a/app/modules/AppKit/lib/database/models/generated/BaseNsmRole.php b/app/modules/AppKit/lib/database/models/generated/BaseNsmRole.php
index 697aad0..a60b63d 100755
--- a/app/modules/AppKit/lib/database/models/generated/BaseNsmRole.php
+++ b/app/modules/AppKit/lib/database/models/generated/BaseNsmRole.php
@@ -107,10 +107,10 @@ abstract class BaseNsmRole extends Doctrine_Record
 
     public static function getInitialData() {
 		return array(
-			array('role_id'=>'1','role_name'=>'icinga_user','role_description'=>'The default representation of a ICINGA user','role_disabled'=>'0','role_parent'=>''),
-			array('role_id'=>'2','role_name'=>'appkit_user','role_description'=>'Appkit user test','role_disabled'=>'0','role_parent'=>''),
+			array('role_id'=>'1','role_name'=>'icinga_user','role_description'=>'The default representation of a ICINGA user','role_disabled'=>'0'),
+			array('role_id'=>'2','role_name'=>'appkit_user','role_description'=>'Appkit user test','role_disabled'=>'0'),
 			array('role_id'=>'3','role_name'=>'appkit_admin','role_description'=>'AppKit admin','role_disabled'=>'0','role_parent'=>'2'),
-			array('role_id'=>'4','role_name'=>'guest','role_description'=>'Unauthorized Guest','role_disabled'=>'0','role_parent'=>'')
+			array('role_id'=>'4','role_name'=>'guest','role_description'=>'Unauthorized Guest','role_disabled'=>'0')
 		);
     }
 }
\ No newline at end of file
diff --git a/etc/lib/dbInitializeTask.php b/etc/lib/dbInitializeTask.php
index 42f3465..14d40e3 100644
--- a/etc/lib/dbInitializeTask.php
+++ b/etc/lib/dbInitializeTask.php
@@ -29,12 +29,12 @@ class dbInitializeTask extends doctrineTask {
 	protected function createTables() {
 		try {
 			Doctrine::createTablesFromModels(array(
-				$this->modelPath."generated/",
-				$this->modelPath."/"
+				$this->modelPath
+
 				)
 			);
 		} catch(Doctrine_Exception $e) {
-			throw new BuildException("Couldn't create schema - are you sure the table doesn't already exist? If so, use the update command.");
+			echo("Error during schema creation - are you sure the table doesn't already exist? If so, use the update command.\n\n".$e->getMessage());
 		}
 	}
 	
@@ -44,7 +44,7 @@ class dbInitializeTask extends doctrineTask {
 		 * until everything is inserted. If there are missing relations, just try it next time
 		 **/ 
 		$tries = 0;
-		$maxTries = 15;
+		$maxTries = 30;
 		$order = 0;
 		do {	
 			$allsaved = true;
@@ -68,7 +68,9 @@ class dbInitializeTask extends doctrineTask {
 					$result = false;
 					try { 
 						$result = $record->trySave();
-					} catch(Exception $e) {/*..ignore..*/}
+					} catch(Exception $e) {/*..ignore..*/
+					}
+					
 					
 					if($result)
 						$this->insertedData[$order++] = serialize($initData);	





More information about the icinga-checkins mailing list