aboutsummaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-05-30 19:44:30 -0700
committerredmatrix <git@macgirvin.com>2016-05-30 19:44:30 -0700
commit6602ff83dd54d0e17c985a5f527654fc2ed83eea (patch)
tree920d7fa37f10786e806e847cf6b59b20a42e7cb8 /install
parent490ab9e2c593275c0cf3d705a4ae52c6a22db4d9 (diff)
downloadvolse-hubzilla-6602ff83dd54d0e17c985a5f527654fc2ed83eea.tar.gz
volse-hubzilla-6602ff83dd54d0e17c985a5f527654fc2ed83eea.tar.bz2
volse-hubzilla-6602ff83dd54d0e17c985a5f527654fc2ed83eea.zip
start removing reserved words from database column names (this run: addon and hook)
Diffstat (limited to 'install')
-rw-r--r--install/schema_mysql.sql8
-rw-r--r--install/schema_postgres.sql8
-rw-r--r--install/update.php20
3 files changed, 27 insertions, 9 deletions
diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index a674ab8c4..68b739f7a 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -96,15 +96,15 @@ CREATE TABLE IF NOT EXISTS `account` (
CREATE TABLE IF NOT EXISTS `addon` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `name` char(255) NOT NULL DEFAULT '',
+ `aname` char(255) NOT NULL DEFAULT '',
`version` char(255) NOT NULL DEFAULT '',
`installed` tinyint(1) NOT NULL DEFAULT '0',
`hidden` tinyint(1) NOT NULL DEFAULT '0',
- `timestamp` bigint(20) NOT NULL DEFAULT '0',
+ `tstamp` bigint(20) NOT NULL DEFAULT '0',
`plugin_admin` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `hidden` (`hidden`),
- KEY `name` (`name`),
+ KEY `aname` (`aname`),
KEY `installed` (`installed`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@@ -519,7 +519,7 @@ CREATE TABLE IF NOT EXISTS `hook` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`hook` char(255) NOT NULL DEFAULT '',
`file` char(255) NOT NULL DEFAULT '',
- `function` char(255) NOT NULL DEFAULT '',
+ `fn` char(255) NOT NULL DEFAULT '',
`priority` int(11) unsigned NOT NULL DEFAULT '0',
`hook_version` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql
index e2c078dc1..76a3a013e 100644
--- a/install/schema_postgres.sql
+++ b/install/schema_postgres.sql
@@ -94,16 +94,16 @@ create index "account_level" on account ("account_level");
create index "account_password_changed" on account ("account_password_changed");
CREATE TABLE "addon" (
"id" serial NOT NULL,
- "name" text NOT NULL,
+ "aname" text NOT NULL,
"version" text NOT NULL DEFAULT '0',
"installed" numeric(1) NOT NULL DEFAULT '0',
"hidden" numeric(1) NOT NULL DEFAULT '0',
- "timestamp" numeric(20) NOT NULL DEFAULT '0',
+ "tstamp" numeric(20) NOT NULL DEFAULT '0',
"plugin_admin" numeric(1) NOT NULL DEFAULT '0',
PRIMARY KEY ("id")
);
create index "addon_hidden_idx" on addon ("hidden");
-create index "addon_name_idx" on addon ("name");
+create index "addon_name_idx" on addon ("aname");
create index "addon_installed_idx" on addon ("installed");
CREATE TABLE "app" (
"id" serial NOT NULL,
@@ -514,7 +514,7 @@ CREATE TABLE "hook" (
"id" serial NOT NULL,
"hook" text NOT NULL,
"file" text NOT NULL,
- "function" text NOT NULL,
+ "fn" text NOT NULL,
"priority" bigint NOT NULL DEFAULT '0',
"hook_version" smallint NOT NULL DEFAULT '0',
PRIMARY KEY ("id")
diff --git a/install/update.php b/install/update.php
index 983db1bb9..686c199b5 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1169 );
+define( 'UPDATE_VERSION' , 1170 );
/**
*
@@ -2114,3 +2114,21 @@ function update_r1168() {
return UPDATE_FAILED;
}
+function update_r1169() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE `addon` CHANGE `timestamp` `tstamp` numeric( 20 ) UNSIGNED NOT NULL DEFAULT '0' ");
+ $r2 = q("ALTER TABLE `addon` CHANGE `name` `aname` text NOT NULL DEFAULT '' ");
+ $r3 = q("ALTER TABLE `hook` CHANGE `function` `fn` text NOT NULL DEFAULT '' ");
+
+ }
+ else {
+ $r1 = q("ALTER TABLE `addon` CHANGE `timestamp` `tstamp` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0' ");
+ $r2 = q("ALTER TABLE `addon` CHANGE `name` `aname` CHAR(255) NOT NULL DEFAULT '' ");
+ $r3 = q("ALTER TABLE `hook` CHANGE `function` `fn` CHAR(255) NOT NULL DEFAULT '' ");
+ }
+
+ if($r1 && $r2 && $r3)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+} \ No newline at end of file