aboutsummaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
Diffstat (limited to 'install')
-rw-r--r--install/schema_mysql.sql44
-rw-r--r--install/schema_postgres.sql46
-rw-r--r--install/update.php70
3 files changed, 114 insertions, 46 deletions
diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index e5bb7b889..a536c3f9a 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -158,7 +158,7 @@ CREATE TABLE IF NOT EXISTS `attach` (
`os_storage` tinyint(1) NOT NULL DEFAULT '0',
`os_path` mediumtext NOT NULL,
`display_path` mediumtext NOT NULL,
- `data` longblob NOT NULL,
+ `content` longblob NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`allow_cid` mediumtext NOT NULL,
@@ -398,15 +398,15 @@ CREATE TABLE IF NOT EXISTS `event` (
`event_hash` char(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `start` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `finish` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `dtstart` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `dtend` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`summary` text NOT NULL,
`description` text NOT NULL,
`location` text NOT NULL,
- `type` char(255) NOT NULL DEFAULT '',
+ `etype` char(255) NOT NULL DEFAULT '',
`nofinish` tinyint(1) NOT NULL DEFAULT '0',
`adjust` tinyint(1) NOT NULL DEFAULT '1',
- `ignore` tinyint(1) NOT NULL DEFAULT '0',
+ `dismissed` tinyint(1) NOT NULL DEFAULT '0',
`allow_cid` mediumtext NOT NULL,
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,
@@ -420,12 +420,12 @@ CREATE TABLE IF NOT EXISTS `event` (
`event_vdata` text NOT NULL,
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
- KEY `type` (`type`),
- KEY `start` (`start`),
- KEY `finish` (`finish`),
+ KEY `etype` (`etype`),
+ KEY `dtstart` (`dtstart`),
+ KEY `dtend` (`dtend`),
KEY `adjust` (`adjust`),
KEY `nofinish` (`nofinish`),
- KEY `ignore` (`ignore`),
+ KEY `dismissed` (`dismissed`),
KEY `aid` (`aid`),
KEY `event_hash` (`event_hash`),
KEY `event_xchan` (`event_xchan`),
@@ -569,7 +569,7 @@ CREATE TABLE IF NOT EXISTS `item` (
`revision` int(10) unsigned NOT NULL DEFAULT '0',
`verb` char(255) NOT NULL DEFAULT '',
`obj_type` char(255) NOT NULL DEFAULT '',
- `object` text NOT NULL,
+ `obj` text NOT NULL,
`tgt_type` char(255) NOT NULL DEFAULT '',
`target` text NOT NULL,
`layout_mid` char(255) NOT NULL DEFAULT '',
@@ -791,24 +791,24 @@ CREATE TABLE IF NOT EXISTS `menu_item` (
CREATE TABLE IF NOT EXISTS `notify` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`hash` char(64) NOT NULL DEFAULT '',
- `name` char(255) NOT NULL DEFAULT '',
+ `xname` char(255) NOT NULL DEFAULT '',
`url` char(255) NOT NULL DEFAULT '',
`photo` char(255) NOT NULL DEFAULT '',
- `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`msg` mediumtext NOT NULL,
`aid` int(11) NOT NULL DEFAULT '0',
`uid` int(11) NOT NULL DEFAULT '0',
`link` char(255) NOT NULL DEFAULT '',
`parent` char(255) NOT NULL DEFAULT '',
`seen` tinyint(1) NOT NULL DEFAULT '0',
- `type` int(11) NOT NULL DEFAULT '0',
+ `ntype` int(11) NOT NULL DEFAULT '0',
`verb` char(255) NOT NULL DEFAULT '',
`otype` char(16) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
- KEY `type` (`type`),
+ KEY `ntype` (`ntype`),
KEY `seen` (`seen`),
KEY `uid` (`uid`),
- KEY `date` (`date`),
+ KEY `created` (`created`),
KEY `hash` (`hash`),
KEY `parent` (`parent`),
KEY `link` (`link`),
@@ -893,12 +893,12 @@ CREATE TABLE IF NOT EXISTS `photo` (
`description` text NOT NULL,
`album` char(255) NOT NULL DEFAULT '',
`filename` char(255) NOT NULL DEFAULT '',
- `type` char(128) NOT NULL DEFAULT 'image/jpeg',
+ `mimetype` char(128) NOT NULL DEFAULT 'image/jpeg',
`height` smallint(6) NOT NULL DEFAULT '0',
`width` smallint(6) NOT NULL DEFAULT '0',
- `size` int(10) unsigned NOT NULL DEFAULT '0',
- `data` mediumblob NOT NULL,
- `scale` tinyint(3) NOT NULL DEFAULT '0',
+ `filesize` int(10) unsigned NOT NULL DEFAULT '0',
+ `content` mediumblob NOT NULL,
+ `imgscale` tinyint(3) NOT NULL DEFAULT '0',
`photo_usage` smallint(6) NOT NULL DEFAULT '0',
`profile` tinyint(1) NOT NULL DEFAULT '0',
`is_nsfw` tinyint(1) NOT NULL DEFAULT '0',
@@ -913,13 +913,13 @@ CREATE TABLE IF NOT EXISTS `photo` (
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `album` (`album`),
- KEY `scale` (`scale`),
+ KEY `imgscale` (`imgscale`),
KEY `profile` (`profile`),
KEY `photo_flags` (`photo_flags`),
- KEY `type` (`type`),
+ KEY `mimetype` (`mimetype`),
KEY `aid` (`aid`),
KEY `xchan` (`xchan`),
- KEY `size` (`size`),
+ KEY `filesize` (`filesize`),
KEY `resource_id` (`resource_id`),
KEY `is_nsfw` (`is_nsfw`),
KEY `os_storage` (`os_storage`),
diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql
index bda1b8970..b637fea43 100644
--- a/install/schema_postgres.sql
+++ b/install/schema_postgres.sql
@@ -154,7 +154,7 @@ CREATE TABLE "attach" (
"os_storage" smallint NOT NULL DEFAULT '0',
"os_path" text NOT NULL,
"display_path" text NOT NULL,
- "data" bytea NOT NULL,
+ "content" bytea NOT NULL,
"created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"allow_cid" text NOT NULL,
@@ -390,17 +390,17 @@ CREATE TABLE "event" (
"uid" bigint NOT NULL,
"event_xchan" text NOT NULL DEFAULT '',
"event_hash" text NOT NULL DEFAULT '',
- "created" timestamp NOT NULL,
- "edited" timestamp NOT NULL,
- "start" timestamp NOT NULL,
- "finish" timestamp NOT NULL,
+ "created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
+ "edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
+ "dtstart" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
+ "dtend" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"summary" text NOT NULL,
"description" text NOT NULL,
"location" text NOT NULL,
- "type" text NOT NULL,
+ "etype" text NOT NULL,
"nofinish" numeric(1) NOT NULL DEFAULT '0',
"adjust" numeric(1) NOT NULL DEFAULT '1',
- "ignore" numeric(1) NOT NULL DEFAULT '0',
+ "dismissed" numeric(1) NOT NULL DEFAULT '0',
"allow_cid" text NOT NULL,
"allow_gid" text NOT NULL,
"deny_cid" text NOT NULL,
@@ -415,12 +415,12 @@ CREATE TABLE "event" (
PRIMARY KEY ("id")
);
create index "event_uid_idx" on event ("uid");
-create index "event_type_idx" on event ("type");
-create index "event_start_idx" on event ("start");
-create index "event_finish_idx" on event ("finish");
+create index "event_etype_idx" on event ("etype");
+create index "event_dtstart_idx" on event ("dtstart");
+create index "event_dtend_idx" on event ("dtend");
create index "event_adjust_idx" on event ("adjust");
create index "event_nofinish_idx" on event ("nofinish");
-create index "event_ignore_idx" on event ("ignore");
+create index "event_dismissed_idx" on event ("dismissed");
create index "event_aid_idx" on event ("aid");
create index "event_hash_idx" on event ("event_hash");
create index "event_xchan_idx" on event ("event_xchan");
@@ -560,7 +560,7 @@ CREATE TABLE "item" (
"revision" bigint NOT NULL DEFAULT '0',
"verb" text NOT NULL DEFAULT '',
"obj_type" text NOT NULL DEFAULT '',
- "object" text NOT NULL,
+ "obj" text NOT NULL,
"tgt_type" text NOT NULL DEFAULT '',
"target" text NOT NULL,
"layout_mid" text NOT NULL DEFAULT '',
@@ -781,25 +781,25 @@ create index "mitem_flags" on menu_item ("mitem_flags");
CREATE TABLE "notify" (
"id" serial NOT NULL,
"hash" char(64) NOT NULL,
- "name" text NOT NULL,
+ "xname" text NOT NULL,
"url" text NOT NULL,
"photo" text NOT NULL,
- "date" timestamp NOT NULL,
+ "created" timestamp NOT NULL,
"msg" text NOT NULL DEFAULT '',
"aid" bigint NOT NULL,
"uid" bigint NOT NULL,
"link" text NOT NULL,
"parent" text NOT NULL DEFAULT '',
"seen" numeric(1) NOT NULL DEFAULT '0',
- "type" bigint NOT NULL,
+ "ntype" bigint NOT NULL,
"verb" text NOT NULL,
"otype" varchar(16) NOT NULL,
PRIMARY KEY ("id")
);
-create index "notify_type" on notify ("type");
+create index "notify_ntype" on notify ("ntype");
create index "notify_seen" on notify ("seen");
create index "notify_uid" on notify ("uid");
-create index "notify_date" on notify ("date");
+create index "notify_created" on notify ("created");
create index "notify_hash" on notify ("hash");
create index "notify_parent" on notify ("parent");
create index "notify_link" on notify ("link");
@@ -882,12 +882,12 @@ CREATE TABLE "photo" (
"description" text NOT NULL,
"album" text NOT NULL,
"filename" text NOT NULL,
- "type" varchar(128) NOT NULL DEFAULT 'image/jpeg',
+ "mimetype" varchar(128) NOT NULL DEFAULT 'image/jpeg',
"height" numeric(6) NOT NULL,
"width" numeric(6) NOT NULL,
- "size" bigint NOT NULL DEFAULT '0',
- "data" bytea NOT NULL,
- "scale" numeric(3) NOT NULL,
+ "filesize" bigint NOT NULL DEFAULT '0',
+ "content" bytea NOT NULL,
+ "imgscale" numeric(3) NOT NULL DEFAULT '0',
"profile" numeric(1) NOT NULL DEFAULT '0',
"photo_usage" smallint NOT NULL DEFAULT '0',
"is_nsfw" smallint NOT NULL DEFAULT '0',
@@ -903,13 +903,13 @@ CREATE TABLE "photo" (
);
create index "photo_uid" on photo ("uid");
create index "photo_album" on photo ("album");
-create index "photo_scale" on photo ("scale");
+create index "photo_imgscale" on photo ("imgscale");
create index "photo_profile" on photo ("profile");
create index "photo_flags" on photo ("photo_flags");
create index "photo_type" on photo ("type");
create index "photo_aid" on photo ("aid");
create index "photo_xchan" on photo ("xchan");
-create index "photo_size" on photo ("size");
+create index "photo_filesize" on photo ("filesize");
create index "photo_resource_id" on photo ("resource_id");
create index "photo_usage" on photo ("photo_usage");
create index "photo_is_nsfw" on photo ("is_nsfw");
diff --git a/install/update.php b/install/update.php
index dd0131ee8..3e18c9840 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1173 );
+define( 'UPDATE_VERSION' , 1176 );
/**
*
@@ -2186,3 +2186,71 @@ function update_r1172() {
return UPDATE_FAILED;
}
+
+function update_r1173() {
+
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE notify CHANGE `name` `xname` TEXT NOT NULL ");
+ $r2 = q("ALTER TABLE notify CHANGE `date` `created` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ $r3 = q("ALTER TABLE notify CHANGE `type` `ntype` numeric(3) NOT NULL DEFAULT '0' ");
+ }
+ else {
+ $r1 = q("ALTER TABLE notify CHANGE `name` `xname` char(255) NOT NULL DEFAULT '' ");
+ $r2 = q("ALTER TABLE notify CHANGE `date` `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ");
+ $r3 = q("ALTER TABLE notify CHANGE `type` `ntype` smallint(3) NOT NULL DEFAULT '0' ");
+ }
+
+ if($r1 && $r2 && $r3)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+function update_r1174() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE event CHANGE `type` `etype` varchar(255) NOT NULL DEFAULT '' ");
+ $r2 = q("ALTER TABLE event CHANGE `start` `dtstart` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ $r3 = q("ALTER TABLE event CHANGE `finish` `dtend` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ $r4 = q("ALTER TABLE event CHANGE `ignore` `dismissed` numeric(1) NOT NULL DEFAULT '0' ");
+ $r5 = q("ALTER TABLE attach CHANGE `data` `content` bytea NOT NULL ");
+ $r6 = q("ALTER TABLE photo CHANGE `data` `content` bytea NOT NULL ");
+ }
+ else {
+ $r1 = q("ALTER TABLE event CHANGE `type` `etype` char(255) NOT NULL DEFAULT '' ");
+ $r2 = q("ALTER TABLE event CHANGE `start` `dtstart` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ");
+ $r3 = q("ALTER TABLE event CHANGE `finish` `dtend` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ");
+ $r4 = q("ALTER TABLE event CHANGE `ignore` `dismissed` tinyint(1) NOT NULL DEFAULT '0' ");
+ $r5 = q("ALTER TABLE attach CHANGE `data` `content` longblob NOT NULL ");
+ $r6 = q("ALTER TABLE photo CHANGE `data` `content` mediumblob NOT NULL ");
+ }
+
+ if($r1 && $r2 && $r3 && $r4 && $r5 && $r6)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+function update_r1175() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE item CHANGE `object` `obj` text NOT NULL");
+ $r2 = q("ALTER TABLE photo CHANGE `size` `filesize` bigint NOT NULL DEFAULT '0' ");
+ $r3 = q("ALTER TABLE photo CHANGE `scale` `imgscale` numeric(3) NOT NULL DEFAULT '0' ");
+ $r4 = q("ALTER TABLE photo CHANGE `type` `mimetype` varchar(128) NOT NULL DEFAULT 'image/jpeg' ");
+
+ }
+ else {
+ $r1 = q("ALTER TABLE item CHANGE `object` `obj` text NOT NULL");
+ $r2 = q("ALTER TABLE photo CHANGE `size` `filesize` int(10) unsigned NOT NULL DEFAULT '0' ");
+ $r3 = q("ALTER TABLE photo CHANGE `scale` `imgscale` tinyint(3) unsigned NOT NULL DEFAULT '0' ");
+ $r4 = q("ALTER TABLE photo CHANGE `type` `mimetype` char(128) NOT NULL DEFAULT 'image/jpeg' ");
+
+ }
+
+ if($r1)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}