added the untested oracle schema file
This commit is contained in:
parent
bc4f0d2cae
commit
21b84fe0cd
@ -9,8 +9,8 @@ CODEPOT
|
||||
|
||||
UPGRADING FROM 0.2.0
|
||||
|
||||
The code_hide_details column in the user_settings table has been renamed
|
||||
to code_hide_metadata. You must rename your existing database manually.
|
||||
You must make the following changes to your existing database manually
|
||||
if you are upgrading from 0.2.0.
|
||||
|
||||
mysql> ALTER TABLE user_settings CHANGE code_hide_details code_hide_metadata CHAR(1) NOT NULL;
|
||||
mysql> ALTER TABLE site ADD COLUMN(summary VARCHAR(255) NOT NULL);
|
||||
|
@ -16,17 +16,17 @@ CREATE TABLE site (
|
||||
) charset=utf8 engine=InnoDB;
|
||||
|
||||
CREATE TABLE project (
|
||||
id VARCHAR(32) PRIMARY KEY,
|
||||
name VARCHAR(255) UNIQUE NOT NULL,
|
||||
summary VARCHAR(255) NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
commitable CHAR(1) NOT NULL DEFAULT 'Y',
|
||||
public CHAR(1) NOT NULL DEFAULT 'Y',
|
||||
id VARCHAR(32) PRIMARY KEY,
|
||||
name VARCHAR(255) UNIQUE NOT NULL,
|
||||
summary VARCHAR(255) NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
commitable CHAR(1) NOT NULL DEFAULT 'Y',
|
||||
public CHAR(1) NOT NULL DEFAULT 'Y',
|
||||
|
||||
createdon DATETIME NOT NULL,
|
||||
updatedon DATETIME NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL
|
||||
createdon DATETIME NOT NULL,
|
||||
updatedon DATETIME NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL
|
||||
|
||||
) charset=utf8 engine=InnoDB;
|
||||
|
||||
@ -117,18 +117,18 @@ CREATE TABLE issue_attachment (
|
||||
) charset=utf8 engine=InnoDB;
|
||||
|
||||
CREATE TABLE issue_change (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
id BIGINT NOT NULL,
|
||||
sno BIGINT NOT NULL,
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
id BIGINT NOT NULL,
|
||||
sno BIGINT NOT NULL,
|
||||
|
||||
type VARCHAR(32) NOT NULL,
|
||||
status VARCHAR(32) NOT NULL,
|
||||
owner VARCHAR(255) NOT NULL,
|
||||
priority VARCHAR(32) NOT NULL,
|
||||
comment TEXT NOT NULL,
|
||||
type VARCHAR(32) NOT NULL,
|
||||
status VARCHAR(32) NOT NULL,
|
||||
owner VARCHAR(255) NOT NULL,
|
||||
priority VARCHAR(32) NOT NULL,
|
||||
comment TEXT NOT NULL,
|
||||
|
||||
updatedon DATETIME NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL,
|
||||
updatedon DATETIME NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL,
|
||||
|
||||
PRIMARY KEY (projectid, id, sno),
|
||||
KEY issue_update_time (projectid, id, updatedon),
|
||||
@ -180,16 +180,16 @@ CREATE TABLE file (
|
||||
) charset=utf8 engine=InnoDB;
|
||||
|
||||
CREATE TABLE code_review (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
rev BIGINT NOT NULL,
|
||||
sno BIGINT NOT NULL,
|
||||
comment TEXT NOT NULL,
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
rev BIGINT NOT NULL,
|
||||
sno BIGINT NOT NULL,
|
||||
comment TEXT NOT NULL,
|
||||
|
||||
createdon DATETIME NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
createdon DATETIME NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
|
||||
updatedon DATETIME NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL,
|
||||
updatedon DATETIME NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL,
|
||||
|
||||
UNIQUE KEY code_review_id (projectid, rev, sno),
|
||||
|
||||
|
244
codepot/etc/codepot.oracle
Normal file
244
codepot/etc/codepot.oracle
Normal file
@ -0,0 +1,244 @@
|
||||
-- ------------------------------------------------------------
|
||||
-- This file is the Codepot database schema file for PostreSQL.
|
||||
-- Note this file doesn't mandate which database to use.
|
||||
--
|
||||
-- Assumining "local all all password" in /var/lib/pgsql/data/pg_hba.conf
|
||||
--
|
||||
-- $ sqlplus "scott/tiger@(DESCRIPTION=(ADDRESS=(COMMUNITY=tcp.world)(PROTOCOL=TCP)(HOST=192.168.1.126)(PORT=1521))(CONNECT_DATA=(SID=ORCL)))"
|
||||
-- SQL> @codepot.oracle
|
||||
--
|
||||
--
|
||||
-- DROP SEQUENCE "cpot_log_id_seq";
|
||||
-- DROP TABLE "cpot_user";
|
||||
-- DROP TABLE "cpot_user_settings";
|
||||
-- DROP TABLE "cpot_log";
|
||||
-- DROP TABLE "cpot_code_review";
|
||||
-- DROP TABLE "cpot_file";
|
||||
-- DROP TABLE "cpot_issue_change_attachment";
|
||||
-- DROP TABLE "cpot_issue_change";
|
||||
-- DROP TABLE "cpot_issue_attachment";
|
||||
-- DROP TABLE "cpot_issue";
|
||||
-- DROP TABLE "cpot_wiki_attachment";
|
||||
-- DROP TABLE "cpot_wiki";
|
||||
-- DROP TABLE "cpot_project_membership";
|
||||
-- DROP TABLE "cpot_project";
|
||||
-- DROP TABLE "cpot_site";
|
||||
-- ------------------------------------------------------------
|
||||
|
||||
CREATE TABLE "cpot_site" (
|
||||
"id" VARCHAR(32) PRIMARY KEY,
|
||||
"name" VARCHAR(128) NOT NULL,
|
||||
"summary" VARCHAR(255) NOT NULL,
|
||||
"text" CLOB NOT NULL,
|
||||
"createdon" TIMESTAMP NOT NULL,
|
||||
"updatedon" TIMESTAMP NOT NULL,
|
||||
"createdby" VARCHAR(32) NOT NULL,
|
||||
"updatedby" VARCHAR(32) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE "cpot_project" (
|
||||
"id" VARCHAR(32) PRIMARY KEY,
|
||||
"name" VARCHAR(255) UNIQUE NOT NULL,
|
||||
"summary" VARCHAR(255) NOT NULL,
|
||||
"description" CLOB NOT NULL,
|
||||
"commitable" CHAR(1) DEFAULT 'Y' NOT NULL,
|
||||
"public" CHAR(1) DEFAULT 'Y' NOT NULL,
|
||||
"createdon" TIMESTAMP NOT NULL,
|
||||
"updatedon" TIMESTAMP NOT NULL,
|
||||
"createdby" VARCHAR(32) NOT NULL,
|
||||
"updatedby" VARCHAR(32) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE "cpot_project_membership" (
|
||||
"projectid" VARCHAR(32) NOT NULL,
|
||||
"userid" VARCHAR(32) NOT NULL,
|
||||
"priority" INTEGER NOT NULL,
|
||||
UNIQUE ("projectid", "userid"),
|
||||
CONSTRAINT membership_projectid FOREIGN KEY ("projectid") REFERENCES "cpot_project"("id") ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE "cpot_wiki" (
|
||||
"projectid" VARCHAR(32) NOT NULL,
|
||||
"name" VARCHAR(255) NOT NULL,
|
||||
"text" CLOB NOT NULL,
|
||||
"columns" INT DEFAULT 1 NOT NULL,
|
||||
"createdon" TIMESTAMP NOT NULL,
|
||||
"updatedon" TIMESTAMP NOT NULL,
|
||||
"createdby" VARCHAR(32) NOT NULL,
|
||||
"updatedby" VARCHAR(32) NOT NULL,
|
||||
UNIQUE ("projectid", "name"),
|
||||
CONSTRAINT wiki_projectid FOREIGN KEY ("projectid") REFERENCES "cpot_project"("id")
|
||||
);
|
||||
-- [ NOTE ] oracle defaults to ON DELETE RESTRICT if it is not specified.
|
||||
|
||||
CREATE TABLE "cpot_wiki_attachment" (
|
||||
"projectid" VARCHAR(32) NOT NULL,
|
||||
"wikiname" VARCHAR(255) NOT NULL,
|
||||
"name" VARCHAR(255) NOT NULL,
|
||||
"encname" VARCHAR(255) NOT NULL,
|
||||
"createdon" TIMESTAMP NOT NULL,
|
||||
"createdby" VARCHAR(32) NOT NULL,
|
||||
UNIQUE ("projectid", "wikiname", "name"),
|
||||
CONSTRAINT wiki_attachment_projectid FOREIGN KEY ("projectid") REFERENCES "cpot_project"("id"),
|
||||
CONSTRAINT wiki_attachment_wikiid FOREIGN KEY ("projectid","wikiname") REFERENCES "cpot_wiki"("projectid","name")
|
||||
);
|
||||
|
||||
CREATE TABLE "cpot_issue" (
|
||||
"projectid" VARCHAR(32) NOT NULL,
|
||||
"id" NUMBER(20,0) NOT NULL,
|
||||
"summary" VARCHAR(255) NOT NULL,
|
||||
"description" CLOB NOT NULL,
|
||||
"type" VARCHAR(32) NOT NULL,
|
||||
"status" VARCHAR(32) NOT NULL,
|
||||
"owner" VARCHAR(255) NOT NULL,
|
||||
"priority" VARCHAR(32) NOT NULL,
|
||||
"createdon" TIMESTAMP NOT NULL,
|
||||
"updatedon" TIMESTAMP NOT NULL,
|
||||
"createdby" VARCHAR(32) NOT NULL,
|
||||
"updatedby" VARCHAR(32) NOT NULL,
|
||||
PRIMARY KEY ("projectid", "id"),
|
||||
CONSTRAINT issue_projectid FOREIGN KEY ("projectid") REFERENCES "cpot_project"("id")
|
||||
);
|
||||
CREATE INDEX cpot_issue_index_1 ON "cpot_issue"("projectid", "status", "type", "summary");
|
||||
CREATE INDEX cpot_issue_index_2 ON "cpot_issue"("projectid", "summary");
|
||||
|
||||
CREATE TABLE "cpot_issue_attachment" (
|
||||
"projectid" VARCHAR(32) NOT NULL,
|
||||
"issueid" NUMBER(20,0) NOT NULL,
|
||||
"name" VARCHAR(255) NOT NULL,
|
||||
"encname" VARCHAR(255) NOT NULL,
|
||||
"createdon" TIMESTAMP NOT NULL,
|
||||
"createdby" VARCHAR(32) NOT NULL,
|
||||
UNIQUE ("projectid", "issueid", "name"),
|
||||
CONSTRAINT issue_attachment_projectid FOREIGN KEY ("projectid") REFERENCES "cpot_project"("id"),
|
||||
CONSTRAINT issue_attachment_issueid FOREIGN KEY ("projectid","issueid") REFERENCES "cpot_issue"("projectid","id")
|
||||
);
|
||||
|
||||
CREATE TABLE "cpot_issue_change" (
|
||||
"projectid" VARCHAR(32) NOT NULL,
|
||||
"id" NUMBER(20,0) NOT NULL,
|
||||
"sno" NUMBER(20,0) NOT NULL,
|
||||
"type" VARCHAR(32) NOT NULL,
|
||||
"status" VARCHAR(32) NOT NULL,
|
||||
"owner" VARCHAR(255) NOT NULL,
|
||||
"priority" VARCHAR(32) NOT NULL,
|
||||
"comment" CLOB NOT NULL,
|
||||
"updatedon" TIMESTAMP NOT NULL,
|
||||
"updatedby" VARCHAR(32) NOT NULL,
|
||||
PRIMARY KEY ("projectid", "id", "sno"),
|
||||
CONSTRAINT issue_update_id FOREIGN KEY ("projectid","id") REFERENCES "cpot_issue"("projectid","id")
|
||||
);
|
||||
|
||||
CREATE INDEX cpot_issue_change_index_1 ON "cpot_issue_change"("projectid", "id", "updatedon");
|
||||
|
||||
CREATE TABLE "cpot_issue_change_attachment" (
|
||||
"projectid" VARCHAR(32) NOT NULL,
|
||||
"issueid" NUMBER(20,0) NOT NULL,
|
||||
"issuesno" NUMBER(20,0) NOT NULL,
|
||||
"name" VARCHAR(255) NOT NULL,
|
||||
"encname" VARCHAR(255) NOT NULL,
|
||||
"createdon" TIMESTAMP NOT NULL,
|
||||
"createdby" VARCHAR(32) NOT NULL,
|
||||
UNIQUE ("projectid", "issueid", "name"),
|
||||
CONSTRAINT issue_change_attachment_c1 FOREIGN KEY ("projectid") REFERENCES "cpot_project"("id"),
|
||||
CONSTRAINT issue_change_attachment_c2 FOREIGN KEY ("projectid","issueid","issuesno") REFERENCES "cpot_issue_change"("projectid","id","sno")
|
||||
);
|
||||
|
||||
CREATE TABLE "cpot_file" (
|
||||
"projectid" VARCHAR(32) NOT NULL,
|
||||
"name" VARCHAR(255) NOT NULL,
|
||||
"encname" VARCHAR(255) NOT NULL,
|
||||
"tag" VARCHAR(54) NOT NULL,
|
||||
"summary" VARCHAR(255) NOT NULL,
|
||||
"md5sum" CHAR(32) NOT NULL,
|
||||
"description" CLOB NOT NULL,
|
||||
"createdon" TIMESTAMP NOT NULL,
|
||||
"updatedon" TIMESTAMP NOT NULL,
|
||||
"createdby" VARCHAR(32) NOT NULL,
|
||||
"updatedby" VARCHAR(32) NOT NULL,
|
||||
UNIQUE ("projectid", "name"),
|
||||
UNIQUE ("encname"),
|
||||
CONSTRAINT file_projectid FOREIGN KEY ("projectid") REFERENCES "cpot_project"("id")
|
||||
);
|
||||
|
||||
CREATE INDEX cpot_file_index_1 ON "cpot_file"("projectid", "tag", "name");
|
||||
|
||||
CREATE TABLE "cpot_code_review" (
|
||||
"projectid" VARCHAR(32) NOT NULL,
|
||||
"rev" NUMBER(20,0) NOT NULL,
|
||||
"sno" NUMBER(20,0) NOT NULL,
|
||||
"comment" CLOB NOT NULL,
|
||||
"createdon" TIMESTAMP NOT NULL,
|
||||
"createdby" VARCHAR(32) NOT NULL,
|
||||
"updatedon" TIMESTAMP NOT NULL,
|
||||
"updatedby" VARCHAR(32) NOT NULL,
|
||||
UNIQUE ("projectid", "rev", "sno"),
|
||||
CONSTRAINT code_review_projectid FOREIGN KEY ("projectid") REFERENCES "cpot_project"("id")
|
||||
);
|
||||
|
||||
CREATE TABLE "cpot_log" (
|
||||
"id" NUMBER(20,0) PRIMARY KEY,
|
||||
"projectid" VARCHAR(32) NOT NULL,
|
||||
"type" VARCHAR(16) NOT NULL,
|
||||
"action" VARCHAR(16) NOT NULL,
|
||||
"userid" VARCHAR(32) NOT NULL,
|
||||
"message" CLOB NOT NULL,
|
||||
"createdon" TIMESTAMP NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX codepopt_log_index_1 ON "cpot_log"("createdon", "projectid", "type", "action");
|
||||
|
||||
CREATE SEQUENCE "cpot_log_id_seq";
|
||||
CREATE OR REPLACE TRIGGER cpot_inc_log_id BEFORE INSERT ON "cpot_log" FOR EACH ROW WHEN (new."id" IS NULL)
|
||||
BEGIN
|
||||
SELECT "cpot_log_id_seq".NEXTVAL INTO :new."id" FROM dual;
|
||||
END;
|
||||
/
|
||||
|
||||
CREATE TABLE "cpot_user_settings" (
|
||||
"userid" VARCHAR(32) PRIMARY KEY,
|
||||
"code_hide_line_num" CHAR(1) NOT NULL,
|
||||
"code_hide_metadata" CHAR(1) NOT NULL,
|
||||
"icon_name" VARCHAR(255) UNIQUE NULL
|
||||
);
|
||||
|
||||
CREATE TABLE "cpot_user" (
|
||||
"userid" VARCHAR(32) PRIMARY KEY,
|
||||
"passwd" VARCHAR(255) NOT NULL,
|
||||
"email" VARCHAR(255),
|
||||
"enabled" CHAR(1) DEFAULT 'N' NOT NULL CHECK("enabled" in ('Y', 'N'))
|
||||
);
|
||||
|
||||
CREATE OR REPLACE TRIGGER cpot_upon_project_id_update AFTER UPDATE OF "id" ON "cpot_project" FOR EACH ROW
|
||||
BEGIN
|
||||
UPDATE "cpot_project_membership" SET "projectid" = :new."id" WHERE "projectid" = :old."id";
|
||||
UPDATE "cpot_wiki" SET "projectid" = :new."id" WHERE "projectid" = :old."id";
|
||||
UPDATE "cpot_wiki_attachment" SET "projectid" = :new."id" WHERE "projectid" = :old."id";
|
||||
UPDATE "cpot_issue" SET "projectid" = :new."id" WHERE "projectid"= :old."id";
|
||||
UPDATE "cpot_issue_attachment" SET "projectid" = :new."id" WHERE "projectid" = :old."id";
|
||||
UPDATE "cpot_issue_change" SET "projectid" = :new."id" WHERE "projectid" = :old."id";
|
||||
UPDATE "cpot_issue_change_attachment" SET "projectid" = :new."id" WHERE "projectid" = :old."id";
|
||||
UPDATE "cpot_file" SET "projectid" = :new."id" WHERE "projectid" = :old."id";
|
||||
UPDATE "cpot_code_review" SET "projectid" = :new."id" WHERE "projectid" = :old."id";
|
||||
END;
|
||||
/
|
||||
|
||||
CREATE OR REPLACE TRIGGER cpot_upon_wiki_name_update AFTER UPDATE OF "name" ON "cpot_wiki" FOR EACH ROW
|
||||
BEGIN
|
||||
UPDATE "cpot_wiki_attachment" SET "wikiname" = :new."name" WHERE "projectid" = :old."projectid" AND "wikiname" = :old."name";
|
||||
END;
|
||||
/
|
||||
|
||||
CREATE OR REPLACE TRIGGER cpot_upon_issue_id_update AFTER UPDATE OF "id" ON "cpot_issue" FOR EACH ROW
|
||||
BEGIN
|
||||
UPDATE "cpot_issue_attachment" SET "issueid" = :new."id" WHERE "projectid" = :old."projectid" AND "issueid" = :old."id";
|
||||
UPDATE "cpot_issue_change" SET "id" = :new."id" WHERE "projectid" = :old."projectid" AND "id" = :old."id";
|
||||
UPDATE "cpot_issue_change_attachment" SET "issueid" = :new."id" WHERE "projectid" = :old."projectid" AND "issueid" = :old."id";
|
||||
END;
|
||||
/
|
||||
|
||||
CREATE OR REPLACE TRIGGER cpot_upon_issue_chsno_update AFTER UPDATE OF "id" ON "cpot_issue_change" FOR EACH ROW
|
||||
BEGIN
|
||||
UPDATE "cpot_issue_change_attachment" SET "issuesno" = :new."sno" WHERE "projectid" = :old."projectid" AND "issueid" = :old."id" AND "issuesno" = :old."sno";
|
||||
END;
|
||||
/
|
@ -112,9 +112,9 @@ CREATE TABLE issue (
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX issue_status_type_summary ON issue(projectid, status, type, summary);
|
||||
CREATE INDEX issue_index_1 ON issue(projectid, status, type, summary);
|
||||
|
||||
CREATE INDEX issue_summary ON issue(projectid, summary);
|
||||
CREATE INDEX issue_index_2 ON issue(projectid, summary);
|
||||
|
||||
CREATE TABLE issue_attachment (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
@ -143,7 +143,7 @@ CREATE TABLE issue_change (
|
||||
status VARCHAR(32) NOT NULL,
|
||||
owner VARCHAR(255) NOT NULL,
|
||||
priority VARCHAR(32) NOT NULL,
|
||||
comment TEXT NOT NULL,
|
||||
comment TEXT NOT NULL,
|
||||
|
||||
updatedon TIMESTAMP NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL,
|
||||
@ -155,7 +155,7 @@ CREATE TABLE issue_change (
|
||||
|
||||
);
|
||||
|
||||
CREATE INDEX issue_update_time ON issue_change(projectid, id, updatedon);
|
||||
CREATE INDEX issue_change_index_1 ON issue_change(projectid, id, updatedon);
|
||||
|
||||
CREATE TABLE issue_change_attachment (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
@ -197,14 +197,13 @@ CREATE TABLE file (
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX file_tagged_name ON file(projectid, tag, name);
|
||||
|
||||
CREATE INDEX file_index_1 ON file(projectid, tag, name);
|
||||
|
||||
CREATE TABLE code_review (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
rev BIGINT NOT NULL,
|
||||
sno BIGINT NOT NULL,
|
||||
comment TEXT NOT NULL,
|
||||
comment TEXT NOT NULL,
|
||||
|
||||
createdon TIMESTAMP NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
@ -228,7 +227,7 @@ CREATE TABLE log (
|
||||
createdon TIMESTAMP NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX log_timed_project_type_action ON log(createdon, projectid, type, action);
|
||||
CREATE INDEX log_index_1 ON log(createdon, projectid, type, action);
|
||||
|
||||
CREATE TABLE user_settings (
|
||||
userid VARCHAR(32) PRIMARY KEY,
|
||||
|
@ -51,7 +51,7 @@ class IssueModel extends Model
|
||||
if ($search->priority != '') $this->db->where ('priority', $search->priority);
|
||||
if ($search->owner != '') $this->db->like ('owner', $search->owner);
|
||||
if ($search->summary != '') $this->db->like ('summary', $search->summary);
|
||||
$this->db->select ('count(id) as count');
|
||||
$this->db->select ('count(*) as count');
|
||||
$query = $this->db->get ('issue');
|
||||
if ($this->db->trans_status() === FALSE)
|
||||
{
|
||||
@ -61,7 +61,8 @@ class IssueModel extends Model
|
||||
|
||||
$result = $query->result();
|
||||
|
||||
$num = empty($result)? 0: $result[0]->count;
|
||||
$num = empty($result)? 0:
|
||||
isset($result[0]->COUNT)? $result[0]->COUNT: $result[0]->count;
|
||||
|
||||
$this->db->trans_complete ();
|
||||
if ($this->db->trans_status() === FALSE) return FALSE;
|
||||
@ -112,10 +113,7 @@ class IssueModel extends Model
|
||||
if ($hour_limit > 0)
|
||||
{
|
||||
//$this->db->where ("updatedon >= SYSDATE() - INTERVAL {$hour_limit} HOUR");
|
||||
if (CODEPOT_DATABASE_DRIVER == 'mysql')
|
||||
$this->db->where ("updatedon >= CURRENT_TIMESTAMP - INTERVAL {$hour_limit} HOUR");
|
||||
else
|
||||
$this->db->where ("updatedon >= CURRENT_TIMESTAMP - INTERVAL '{$hour_limit} HOUR'");
|
||||
$this->db->where ("updatedon >= CURRENT_TIMESTAMP - INTERVAL '{$hour_limit}' HOUR");
|
||||
}
|
||||
|
||||
if (strlen($userid) > 0)
|
||||
@ -180,7 +178,7 @@ class IssueModel extends Model
|
||||
$this->db->set ('updatedby', $userid);
|
||||
$this->db->insert ('issue_change');
|
||||
|
||||
$this->db->set ('createdon', date('Y-m-d H:i:s'));
|
||||
$this->db->set ('createdon', date('Y-m-d H:i:s'));
|
||||
$this->db->set ('type', 'issue');
|
||||
$this->db->set ('action', 'create');
|
||||
$this->db->set ('projectid', $issue->projectid);
|
||||
@ -189,7 +187,7 @@ class IssueModel extends Model
|
||||
$this->db->insert ('log');
|
||||
|
||||
$this->db->trans_complete ();
|
||||
if ($this->db->trans_status() === FALSE) return FALSE;
|
||||
if ($this->db->trans_status() === FALSE) return FALSE;
|
||||
|
||||
return $newid;
|
||||
}
|
||||
@ -211,10 +209,10 @@ class IssueModel extends Model
|
||||
$this->db->set ('projectid', $issue->projectid);
|
||||
$this->db->set ('userid', $userid);
|
||||
$this->db->set ('message', $issue->id);
|
||||
$this->db->insert ('log');
|
||||
$this->db->insert ('log');
|
||||
|
||||
$this->db->trans_complete ();
|
||||
if ($this->db->trans_status() === FALSE) return FALSE;
|
||||
if ($this->db->trans_status() === FALSE) return FALSE;
|
||||
|
||||
return $issue->id;
|
||||
}
|
||||
@ -247,16 +245,16 @@ class IssueModel extends Model
|
||||
$this->db->set ('updatedby', $userid);
|
||||
$this->db->update ('issue_change');
|
||||
|
||||
$this->db->set ('createdon', date('Y-m-d H:i:s'));
|
||||
$this->db->set ('createdon', date('Y-m-d H:i:s'));
|
||||
$this->db->set ('type', 'issue');
|
||||
$this->db->set ('action', 'update');
|
||||
$this->db->set ('projectid', $issue->projectid);
|
||||
$this->db->set ('userid', $userid);
|
||||
$this->db->set ('message', $issue->id);
|
||||
$this->db->insert ('log');
|
||||
$this->db->insert ('log');
|
||||
|
||||
$this->db->trans_complete ();
|
||||
if ($this->db->trans_status() === FALSE) return FALSE;
|
||||
if ($this->db->trans_status() === FALSE) return FALSE;
|
||||
|
||||
return $issue->id;
|
||||
}
|
||||
@ -300,16 +298,16 @@ class IssueModel extends Model
|
||||
$this->db->set ('updatedby', $userid);
|
||||
$this->db->update ('issue');
|
||||
|
||||
$this->db->set ('createdon', date('Y-m-d H:i:s'));
|
||||
$this->db->set ('createdon', date('Y-m-d H:i:s'));
|
||||
$this->db->set ('type', 'issue');
|
||||
$this->db->set ('action', 'change');
|
||||
$this->db->set ('projectid', $project->id);
|
||||
$this->db->set ('userid', $userid);
|
||||
$this->db->set ('message', $id);
|
||||
$this->db->insert ('log');
|
||||
$this->db->insert ('log');
|
||||
|
||||
$this->db->trans_complete ();
|
||||
if ($this->db->trans_status() === FALSE) return FALSE;
|
||||
if ($this->db->trans_status() === FALSE) return FALSE;
|
||||
|
||||
return $id;
|
||||
}
|
||||
@ -395,16 +393,16 @@ class IssueModel extends Model
|
||||
$this->db->where ('id', $issue->id);
|
||||
$this->db->delete ('issue');
|
||||
|
||||
$this->db->set ('createdon', date('Y-m-d H:i:s'));
|
||||
$this->db->set ('createdon', date('Y-m-d H:i:s'));
|
||||
$this->db->set ('type', 'issue');
|
||||
$this->db->set ('action', 'delete');
|
||||
$this->db->set ('projectid', $issue->projectid);
|
||||
$this->db->set ('userid', $userid);
|
||||
$this->db->set ('message', $issue->id);
|
||||
$this->db->insert ('log');
|
||||
$this->db->insert ('log');
|
||||
|
||||
$this->db->trans_complete ();
|
||||
return $this->db->trans_status();
|
||||
return $this->db->trans_status();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class ProjectModel extends Model
|
||||
{
|
||||
$this->db->trans_start ();
|
||||
|
||||
$this->db->select ('count(id) as count');
|
||||
$this->db->select ('count(*) as count');
|
||||
// having this line to make it same as getEntries()
|
||||
// causes postgresql to emit this error:
|
||||
// column "project.name" must appear in the GROUP BY clause or
|
||||
@ -88,7 +88,8 @@ class ProjectModel extends Model
|
||||
|
||||
$result = $query->result();
|
||||
|
||||
$num = empty($result)? 0: $result[0]->count;
|
||||
$num = empty($result)? 0:
|
||||
isset($result[0]->COUNT)? $result[0]->COUNT: $result[0]->count;
|
||||
|
||||
$this->db->trans_complete ();
|
||||
if ($this->db->trans_status() === FALSE) return FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user