mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 01:55:13 +00:00
create url mapping table for nomadic content imports
This commit is contained in:
parent
fc2c0b0149
commit
59dbd66037
4 changed files with 74 additions and 1 deletions
2
boot.php
2
boot.php
|
@ -27,7 +27,7 @@ use Code\Lib\Url;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const REPOSITORY_ID = 'streams';
|
const REPOSITORY_ID = 'streams';
|
||||||
const DB_UPDATE_VERSION = 1281;
|
const DB_UPDATE_VERSION = 1282;
|
||||||
const PROJECT_BASE = __DIR__;
|
const PROJECT_BASE = __DIR__;
|
||||||
const ACTIVITYPUB_ENABLED = true;
|
const ACTIVITYPUB_ENABLED = true;
|
||||||
const NOMAD_PROTOCOL_VERSION = '13.3';
|
const NOMAD_PROTOCOL_VERSION = '13.3';
|
||||||
|
|
|
@ -728,6 +728,16 @@ CREATE TABLE IF NOT EXISTS listeners (
|
||||||
KEY ltype (ltype)
|
KEY ltype (ltype)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS locator (
|
||||||
|
id int NOT NULL AUTO_INCREMENT,
|
||||||
|
locate_old varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
|
||||||
|
locate_new varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
UNIQUE KEY locate_old (locate_old(191)),
|
||||||
|
KEY locate_new (locate_new(191))
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `menu` (
|
CREATE TABLE IF NOT EXISTS `menu` (
|
||||||
`menu_id` int unsigned NOT NULL AUTO_INCREMENT,
|
`menu_id` int unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`menu_channel_id` int unsigned NOT NULL DEFAULT 0 ,
|
`menu_channel_id` int unsigned NOT NULL DEFAULT 0 ,
|
||||||
|
|
|
@ -749,6 +749,16 @@ CREATE TABLE listeners (
|
||||||
create index "target_id_idx" on listeners ("target_id");
|
create index "target_id_idx" on listeners ("target_id");
|
||||||
create index "portable_id_idx" on listeners ("portable_id");
|
create index "portable_id_idx" on listeners ("portable_id");
|
||||||
create index "ltype_idx" on listeners ("ltype");
|
create index "ltype_idx" on listeners ("ltype");
|
||||||
|
|
||||||
|
CREATE TABLE locator (
|
||||||
|
id serial NOT NULL,
|
||||||
|
locate_old text NOT NULL,
|
||||||
|
locate_new text NOT NULL,
|
||||||
|
PRIMARY KEY ("id"),
|
||||||
|
UNIQUE ("locate_old")
|
||||||
|
);
|
||||||
|
create index "locate_new_idx" on locator ("locate_new");
|
||||||
|
|
||||||
CREATE TABLE "menu" (
|
CREATE TABLE "menu" (
|
||||||
"menu_id" serial NOT NULL,
|
"menu_id" serial NOT NULL,
|
||||||
"menu_channel_id" bigint NOT NULL DEFAULT '0',
|
"menu_channel_id" bigint NOT NULL DEFAULT '0',
|
||||||
|
|
53
src/Update/_1282.php
Normal file
53
src/Update/_1282.php
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Code\Update;
|
||||||
|
|
||||||
|
class _1282
|
||||||
|
{
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
q("START TRANSACTION");
|
||||||
|
|
||||||
|
if (ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
|
||||||
|
$r1 = q('CREATE TABLE "locator" (
|
||||||
|
"id" serial NOT NULL,
|
||||||
|
"locate_old" text NOT NULL,
|
||||||
|
"locate_new" text NOT NULL,
|
||||||
|
PRIMARY KEY ("id"),
|
||||||
|
UNIQUE ("locate_old"))');
|
||||||
|
$r2 = q('create index "locate_new_idx" on locator ("locate_new")');
|
||||||
|
$r = ($r1 && $r2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$r = q("CREATE TABLE IF NOT EXISTS locator (
|
||||||
|
id int NOT NULL AUTO_INCREMENT,
|
||||||
|
locate_old varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
|
||||||
|
locate_new varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
UNIQUE KEY locate_old (locate_old(191)),
|
||||||
|
KEY locate_new (locate_new(191))
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($r) {
|
||||||
|
q("COMMIT");
|
||||||
|
return UPDATE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
q("ROLLBACK");
|
||||||
|
return UPDATE_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verify()
|
||||||
|
{
|
||||||
|
$columns = db_columns('locator');
|
||||||
|
|
||||||
|
if ($columns && in_array('locate_old', $columns)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue