Index: modules/project_issue/project_issue.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/project_issue.install,v retrieving revision 1.1.2.3 diff -u -p -r1.1.2.3 project_issue.install --- modules/project_issue/project_issue.install 12 Nov 2006 09:19:34 -0000 1.1.2.3 +++ modules/project_issue/project_issue.install 1 Mar 2007 18:00:28 -0000 @@ -117,6 +117,7 @@ function project_issue_install() { file_size int default 0 NOT NULL, PRIMARY KEY (cid) );"); + db_query("CREATE SEQUENCE {project}_cid_seq INCREMENT 1 START 1"); } if (!project_issue_db_table_exists('project_subscriptions')) { db_query("CREATE TABLE {project_subscriptions} ( @@ -187,6 +188,23 @@ function project_issue_update_1() { return $ret; } +/** + * Add missing sequence for project comments on pgsql. To avoid SQL + * errors when update.php runs (in case the update is run multiple + * times, or a site manually fixed this bug already, etc), we make + * sure this sequence doesn't already exist before we try to create it. + */ +function project_issue_update_2() { + $ret = array(); + switch ($GLOBALS['db_type']) { + case 'pgsql': + if (!db_num_rows(db_query("SELECT relname FROM pg_class WHERE relname = '{project}_cid_seq' AND relkind='S'"))) { + $ret[] = update_sql("CREATE SEQUENCE {project}_cid_seq INCREMENT 1 START 1"); + } + break; + } + return $ret; +} function project_issue_db_table_exists($table) { switch ($GLOBALS['db_type']) {