diff options
author | zotlabs <mike@macgirvin.com> | 2018-02-22 20:52:39 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-02-22 20:52:39 -0800 |
commit | 277da4363194bd652918b100b93fdb0a85f9f689 (patch) | |
tree | 6504fe43d240ae65e32423b8ba2a81cd77967308 /Zotlabs/Update | |
parent | 80ce2def461705ebd0853e99ddfc0d1bc1de2915 (diff) | |
download | volse-hubzilla-277da4363194bd652918b100b93fdb0a85f9f689.tar.gz volse-hubzilla-277da4363194bd652918b100b93fdb0a85f9f689.tar.bz2 volse-hubzilla-277da4363194bd652918b100b93fdb0a85f9f689.zip |
provide DB compatibility for poll and voting implementations across several platforms
Diffstat (limited to 'Zotlabs/Update')
-rw-r--r-- | Zotlabs/Update/_1204.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Zotlabs/Update/_1204.php b/Zotlabs/Update/_1204.php new file mode 100644 index 000000000..f55526415 --- /dev/null +++ b/Zotlabs/Update/_1204.php @@ -0,0 +1,34 @@ +<?php + +namespace Zotlabs\Update; + +class _1204 { + + function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE poll ADD pull_guid text NOT NULL"); + $r2 = q("create index \"poll_guid_idx\" on poll \"poll_guid\""); + $r3 = q("ALTER TABLE poll_elm ADD pelm_guid text NOT NULL"); + $r4 = q("create index \"pelm_guid_idx\" on poll_elm \"pelm_guid\""); + $r5 = q("ALTER TABLE vote ADD vote_guid text NOT NULL"); + $r6 = q("create index \"vote_guid_idx\" on vote \"vote_guid\""); + + $r = ($r1 && $r2 && $r3 && $r4 && $r5 && $r6); + } + else { + $r1 = q("ALTER TABLE `poll` ADD `pull_guid` VARCHAR(191) NOT NULL, ADD INDEX `poll_guid` (`pull_guid`) "); + $r2 = q("ALTER TABLE `poll_elm` ADD `pelm_guid` VARCHAR(191) NOT NULL, ADD INDEX `pelm_guid` (`pelm_guid`) "); + $r1 = q("ALTER TABLE `vote` ADD `vote_guid` VARCHAR(191) NOT NULL, ADD INDEX `vote_guid` (`vote_guid`) "); + + $r = ($r1 && $r2 && $r3); + } + + if($r) + return UPDATE_SUCCESS; + + return UPDATE_FAILED; + + } + +} |