aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-08-20 20:39:00 -0700
committerfriendica <info@friendica.com>2013-08-20 20:39:00 -0700
commit5d35d2110065dec9f984ad9028a5e8798f1faa37 (patch)
treed1ac0165e6ffba08eade52eeb04c052d665d5270
parentc4f14312151dcbff3e5448c5e596f7ca6b317dbe (diff)
downloadvolse-hubzilla-5d35d2110065dec9f984ad9028a5e8798f1faa37.tar.gz
volse-hubzilla-5d35d2110065dec9f984ad9028a5e8798f1faa37.tar.bz2
volse-hubzilla-5d35d2110065dec9f984ad9028a5e8798f1faa37.zip
network-wide poll voting structure
-rwxr-xr-xboot.php2
-rw-r--r--install/database.sql46
-rw-r--r--install/update.php19
3 files changed, 47 insertions, 20 deletions
diff --git a/boot.php b/boot.php
index 10f951b6a..cf3d17050 100755
--- a/boot.php
+++ b/boot.php
@@ -43,7 +43,7 @@ require_once('include/taxonomy.php');
define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1060 );
+define ( 'DB_UPDATE_VERSION', 1061 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
diff --git a/install/database.sql b/install/database.sql
index 4a519adbb..de36bdad2 100644
--- a/install/database.sql
+++ b/install/database.sql
@@ -136,7 +136,7 @@ CREATE TABLE IF NOT EXISTS `challenge` (
`type` char(255) NOT NULL,
`last_update` char(255) NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `channel` (
`channel_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -267,7 +267,7 @@ CREATE TABLE IF NOT EXISTS `event` (
KEY `aid` (`aid`),
KEY `event_hash` (`event_hash`),
KEY `event_xchan` (`event_xchan`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `fcontact` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -348,7 +348,7 @@ CREATE TABLE IF NOT EXISTS `group_member` (
KEY `uid` (`uid`),
KEY `gid` (`gid`),
KEY `xchan` (`xchan`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `hook` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@@ -421,7 +421,7 @@ CREATE TABLE IF NOT EXISTS `item` (
`owner_xchan` char(255) NOT NULL DEFAULT '',
`author_xchan` char(255) NOT NULL DEFAULT '',
`mimetype` char(255) NOT NULL DEFAULT '',
- `title` text NOT NULL DEFAULT '',
+ `title` text NOT NULL,
`body` mediumtext NOT NULL,
`app` char(255) NOT NULL DEFAULT '',
`lang` char(64) NOT NULL DEFAULT '',
@@ -493,7 +493,7 @@ CREATE TABLE IF NOT EXISTS `item_id` (
KEY `sid` (`sid`),
KEY `service` (`service`),
KEY `iid` (`iid`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `mail` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -504,7 +504,7 @@ CREATE TABLE IF NOT EXISTS `mail` (
`channel_id` int(10) unsigned NOT NULL,
`title` text NOT NULL,
`body` mediumtext NOT NULL,
- `attach` mediumtext NOT NULL DEFAULT '',
+ `attach` mediumtext NOT NULL,
`mid` char(255) NOT NULL,
`parent_mid` char(255) NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -536,7 +536,7 @@ CREATE TABLE IF NOT EXISTS `menu` (
PRIMARY KEY (`menu_id`),
KEY `menu_channel_id` (`menu_channel_id`),
KEY `menu_name` (`menu_name`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `menu_item` (
`mitem_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -551,10 +551,10 @@ CREATE TABLE IF NOT EXISTS `menu_item` (
`mitem_menu_id` int(10) unsigned NOT NULL DEFAULT '0',
`mitem_order` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`mitem_id`),
- KEY `mitem_flags` (`mitem_flags`),
KEY `mitem_channel_id` (`mitem_channel_id`),
- KEY `mitem_menu_id` (`mitem_menu_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ KEY `mitem_menu_id` (`mitem_menu_id`),
+ KEY `mitem_flags` (`mitem_flags`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `notify` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@@ -595,7 +595,7 @@ CREATE TABLE IF NOT EXISTS `obj` (
KEY `obj_type` (`obj_type`),
KEY `obj_channel` (`obj_channel`),
KEY `obj_obj` (`obj_obj`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `outq` (
`outq_hash` char(255) NOT NULL,
@@ -658,7 +658,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
KEY `album` (`album`),
KEY `scale` (`scale`),
KEY `profile` (`profile`),
- KEY `photo_flags` (`photo_flags`),
+ KEY `photo_flags` (`photo_flags`),
KEY `type` (`type`),
KEY `aid` (`aid`),
KEY `xchan` (`xchan`),
@@ -676,7 +676,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
`hide_friends` tinyint(1) NOT NULL DEFAULT '0',
`name` char(255) NOT NULL,
`pdesc` char(255) NOT NULL,
- `chandesc` text NOT NULL DEFAULT '',
+ `chandesc` text NOT NULL,
`dob` char(32) NOT NULL DEFAULT '0000-00-00',
`dob_tz` char(255) NOT NULL DEFAULT 'UTC',
`address` char(255) NOT NULL,
@@ -770,7 +770,7 @@ CREATE TABLE IF NOT EXISTS `register` (
KEY `hash` (`hash`),
KEY `created` (`created`),
KEY `uid` (`uid`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `session` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
@@ -842,7 +842,7 @@ CREATE TABLE IF NOT EXISTS `term` (
KEY `imgurl` (`imgurl`),
KEY `term_hash` (`term_hash`),
KEY `parent_hash` (`parent_hash`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tokens` (
`id` varchar(40) NOT NULL,
@@ -877,7 +877,17 @@ CREATE TABLE IF NOT EXISTS `verify` (
KEY `token` (`token`),
KEY `meta` (`meta`),
KEY `created` (`created`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+CREATE TABLE IF NOT EXISTS `vote` (
+ `vote_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `vote_poll` int(11) NOT NULL DEFAULT '0',
+ `vote_element` int(11) NOT NULL DEFAULT '0',
+ `vote_result` text NOT NULL,
+ `vote_xchan` char(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (`vote_id`),
+ UNIQUE KEY `vote_vote` (`vote_poll`,`vote_element`,`vote_xchan`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `xchan` (
`xchan_hash` char(255) NOT NULL,
@@ -902,10 +912,10 @@ CREATE TABLE IF NOT EXISTS `xchan` (
KEY `xchan_addr` (`xchan_addr`),
KEY `xchan_name` (`xchan_name`),
KEY `xchan_network` (`xchan_network`),
- KEY `xchan_instance_url` (`xchan_instance_url`),
KEY `xchan_url` (`xchan_url`),
KEY `xchan_flags` (`xchan_flags`),
- KEY `xchan_connurl` (`xchan_connurl`)
+ KEY `xchan_connurl` (`xchan_connurl`),
+ KEY `xchan_instance_url` (`xchan_instance_url`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `xconfig` (
diff --git a/install/update.php b/install/update.php
index 682ee2aea..fa5afe8de 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1060 );
+define( 'UPDATE_VERSION' , 1061 );
/**
*
@@ -689,3 +689,20 @@ function update_r1059() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
+
+function update_r1060() {
+
+ $r = q("CREATE TABLE IF NOT EXISTS `vote` (
+ `vote_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `vote_poll` int(11) NOT NULL DEFAULT '0',
+ `vote_element` int(11) NOT NULL DEFAULT '0',
+ `vote_result` text NOT NULL,
+ `vote_xchan` char(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (`vote_id`),
+ UNIQUE KEY `vote_vote` (`vote_poll`,`vote_element`,`vote_xchan`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}