PostgreSQL support

Bug: T87542
Change-Id: I1089667c7228412fcb8f98702a8bad19abe76aa1
This commit is contained in:
Jack Phoenix 2020-01-27 04:58:11 +02:00
parent fc458eee43
commit 525a37a284
3 changed files with 24 additions and 0 deletions

View file

@ -597,6 +597,9 @@ During the last 48 hours, $tab2[0] votes have been given.";
$db = $updater->getDB(); $db = $updater->getDB();
$patchPath = __DIR__ . '/../sql/'; $patchPath = __DIR__ . '/../sql/';
if ( $db->getType() == 'postgres' ) {
$patchPath .= 'postgres/';
}
if ( $db->tableExists( 'poll_info' ) ) { if ( $db->tableExists( 'poll_info' ) ) {
# poll_info.poll_title field was dropped in AJAXPoll version 1.72 # poll_info.poll_title field was dropped in AJAXPoll version 1.72

View file

@ -0,0 +1,6 @@
CREATE TABLE IF NOT EXISTS ajaxpoll_info (
poll_id TEXT NOT NULL PRIMARY KEY default '',
poll_txt TEXT,
poll_show_results_before_voting SMALLINT,
poll_date TIMESTAMPTZ default NULL
);

View file

@ -0,0 +1,15 @@
DROP SEQUENCE IF EXISTS ajaxpoll_vote_poll_vote_id_seq CASCADE;
CREATE SEQUENCE ajaxpoll_vote_poll_vote_id_seq;
CREATE TABLE IF NOT EXISTS ajaxpoll_vote (
poll_vote_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('ajaxpoll_vote_poll_vote_id_seq'),
poll_id TEXT NOT NULL default '',
poll_actor INTEGER NOT NULL,
poll_ip TEXT default NULL,
poll_answer SMALLINT default NULL,
poll_date TIMESTAMPTZ default NULL
);
ALTER SEQUENCE ajaxpoll_vote_poll_vote_id_seq OWNED BY ajaxpoll_vote.poll_vote_id;
CREATE UNIQUE INDEX poll_id_actor ON ajaxpoll_vote (poll_id, poll_actor);