forked from Public/pics
Add upgrade script for new tag ownership
This commit is contained in:
parent
a76dde927b
commit
d9fd2ae20d
15
upgrade.sql
Normal file
15
upgrade.sql
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/* 2023-03-11 Allow designating an owner for each tag */
|
||||||
|
ALTER TABLE `tags` ADD `id_user_owner` INT NULL DEFAULT NULL AFTER `id_asset_thumb`;
|
||||||
|
|
||||||
|
/* 2023-03-11 Try to assign tag owners automagically */
|
||||||
|
UPDATE tags AS t
|
||||||
|
SET id_user_owner = (
|
||||||
|
SELECT id_user
|
||||||
|
FROM users AS u
|
||||||
|
WHERE LOWER(u.first_name) = LOWER(t.slug) OR
|
||||||
|
LOWER(u.first_name) = LOWER(t.tag) OR
|
||||||
|
LOWER(u.slug) = LOWER(t.slug) OR
|
||||||
|
LOWER(u.slug) = LOWER(t.tag)
|
||||||
|
)
|
||||||
|
WHERE t.kind = 'Person' AND
|
||||||
|
(t.id_user_owner = 0 OR t.id_user_owner IS NULL);
|
Loading…
Reference in New Issue
Block a user