Simplify the tag table
- Remove auto increment id - Replaced nurl by profile id - Added primary key on the two remaining columns
This commit is contained in:
parent
649cbbf466
commit
4de3fcf5f5
2 changed files with 8 additions and 11 deletions
11
dfrndir.sql
11
dfrndir.sql
|
@ -230,13 +230,10 @@ CREATE TABLE IF NOT EXISTS `sync-timestamps` (
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `tag` (
|
CREATE TABLE IF NOT EXISTS `tag` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`term` varchar(50) NOT NULL,
|
||||||
`term` char(255) NOT NULL,
|
`profile_id` int(11) NOT NULL,
|
||||||
`nurl` char(255) NOT NULL,
|
PRIMARY KEY (`term`,`profile_id`) USING BTREE
|
||||||
PRIMARY KEY (`id`),
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
KEY `term` (`term`(250)),
|
|
||||||
KEY `nurl` (`nurl`(250))
|
|
||||||
) ENGINE=MyISAM AUTO_INCREMENT=101679 DEFAULT CHARSET=utf8mb4;
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ function run_submit($url)
|
||||||
`updated` = '%s'
|
`updated` = '%s'
|
||||||
WHERE `id` = %d LIMIT 1", dbesc(datetime_convert()), intval($profile_id)
|
WHERE `id` = %d LIMIT 1", dbesc(datetime_convert()), intval($profile_id)
|
||||||
);
|
);
|
||||||
$r = q("DELETE FROM `tag` WHERE `nurl` = '%s'",
|
$r = q("DELETE FROM `tag` WHERE `profile_id` = %d",
|
||||||
dbesc($r[0]['nurl'])
|
intval($profile_id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,9 +188,9 @@ function run_submit($url)
|
||||||
$t = substr($t, 0, 254);
|
$t = substr($t, 0, 254);
|
||||||
|
|
||||||
if (strlen($t)) {
|
if (strlen($t)) {
|
||||||
$r = q("INSERT INTO `tag` (`term`, `nurl`) VALUES ('%s', '%s') ",
|
$r = q("INSERT INTO `tag` (`term`, `profile_id`) VALUES ('%s', %d) ",
|
||||||
dbesc($t),
|
dbesc($t),
|
||||||
dbesc($nurl)
|
intval($profile_id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue