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` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`term` char(255) NOT NULL,
|
||||
`nurl` char(255) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `term` (`term`(250)),
|
||||
KEY `nurl` (`nurl`(250))
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=101679 DEFAULT CHARSET=utf8mb4;
|
||||
`term` varchar(50) NOT NULL,
|
||||
`profile_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`term`,`profile_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ function run_submit($url)
|
|||
`updated` = '%s'
|
||||
WHERE `id` = %d LIMIT 1", dbesc(datetime_convert()), intval($profile_id)
|
||||
);
|
||||
$r = q("DELETE FROM `tag` WHERE `nurl` = '%s'",
|
||||
dbesc($r[0]['nurl'])
|
||||
$r = q("DELETE FROM `tag` WHERE `profile_id` = %d",
|
||||
intval($profile_id)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -188,9 +188,9 @@ function run_submit($url)
|
|||
$t = substr($t, 0, 254);
|
||||
|
||||
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($nurl)
|
||||
intval($profile_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue