add nicknames to contact records (going forward and retroactive)
This commit is contained in:
parent
d850badf2b
commit
b8b227b328
7 changed files with 30 additions and 8 deletions
13
update.php
13
update.php
|
@ -80,3 +80,16 @@ function update_1009() {
|
|||
function update_1010() {
|
||||
q("ALTER TABLE `contact` ADD `lrdd` CHAR( 255 ) NOT NULL AFTER `url` ");
|
||||
}
|
||||
|
||||
function update_1011() {
|
||||
q("ALTER TABLE `contact` ADD `nick` CHAR( 255 ) NOT NULL AFTER `name` ");
|
||||
$r = q("SELECT * FROM `contact` WHERE 1");
|
||||
if(count($r)) {
|
||||
foreach($r as $rr) {
|
||||
q("UPDATE `contact` SET `nick` = '%s' WHERE `id` = %d LIMIT 1",
|
||||
dbesc(basename($rr['url'])),
|
||||
intval($rr['id'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue