aboutsummaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-05-27 23:57:47 -0700
committerredmatrix <git@macgirvin.com>2016-05-27 23:57:47 -0700
commitac4688eac087854bf8cb0c893d7a79052ad63a20 (patch)
tree1dba1fae0e25ffe07ccbe4406a2900535429b764 /install
parentab6eb1c4b264b32e7feece290a2463eb747579ed (diff)
downloadvolse-hubzilla-ac4688eac087854bf8cb0c893d7a79052ad63a20.tar.gz
volse-hubzilla-ac4688eac087854bf8cb0c893d7a79052ad63a20.tar.bz2
volse-hubzilla-ac4688eac087854bf8cb0c893d7a79052ad63a20.zip
allow objs to represent inventory
Diffstat (limited to 'install')
-rw-r--r--install/schema_mysql.sql2
-rw-r--r--install/schema_postgres.sql2
-rw-r--r--install/update.php19
3 files changed, 22 insertions, 1 deletions
diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index 4751106da..a674ab8c4 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -883,6 +883,7 @@ CREATE TABLE IF NOT EXISTS `obj` (
`obj_imgurl` char(255) NOT NULL DEFAULT '',
`obj_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`obj_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `obj_quantity` int(11) NOT NULL DEFAULT '0',
`allow_cid` mediumtext NOT NULL,
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,
@@ -897,6 +898,7 @@ CREATE TABLE IF NOT EXISTS `obj` (
KEY `obj_imgurl` (`obj_imgurl`),
KEY `obj_created` (`obj_created`),
KEY `obj_edited` (`obj_edited`),
+ KEY `obj_quantity` (`obj_quantity`),
KEY `obj_obj` (`obj_obj`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql
index 75e53d3dd..e2c078dc1 100644
--- a/install/schema_postgres.sql
+++ b/install/schema_postgres.sql
@@ -873,6 +873,7 @@ CREATE TABLE "obj" (
"obj_imgurl" char(255) NOT NULL DEFAULT '',
"obj_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"obj_edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
+ "obj_quantity" int(11) NOT NULL DEFAUL '0'.
"allow_cid" text NOT NULL,
"allow_gid" text NOT NULL,
"deny_cid" text NOT NULL,
@@ -890,6 +891,7 @@ create index "obj_url" on obj ("obj_url");
create index "obj_imgurl" on obj ("obj_imgurl");
create index "obj_created" on obj ("obj_created");
create index "obj_edited" on obj ("obj_edited");
+create index "obj_quantity" on obj ("obj_quantity");
CREATE TABLE "outq" (
"outq_hash" text NOT NULL,
diff --git a/install/update.php b/install/update.php
index ea1bd8bc7..983db1bb9 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1168 );
+define( 'UPDATE_VERSION' , 1169 );
/**
*
@@ -2097,3 +2097,20 @@ function update_r1167() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
+
+function update_r1168() {
+
+ $r1 = q("alter table obj add obj_quantity int not null default '0' ");
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r2 = q("create index \"obj_quantity_idx\" on obj (\"obj_quantity\") ");
+ }
+ else {
+ $r2 = q("alter table obj add index ( obj_quantity ) ");
+ }
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+