And here’s some SQL I just developed to “multiply” a saved_search from one user to all users.
Backup your table before you begin, handling SQL directly can sometimes be deadly to your data…
INSERT INTO `saved_search`
(
`id`, `name`, `search_module`, `deleted`, `date_entered`, `date_modified`, `assigned_user_id`, `contents`, `description`
)
SELECT
CAST(FLOOR(RAND()*10000000) AS char(36)) `id`,
`name`, `search_module`, `saved_search`.`deleted`, `saved_search`.`date_entered`, `saved_search`.`date_modified`, `users`.`id`, `contents`, `saved_search`.`description`
FROM `saved_search`, `users`
WHERE `saved_search`.`id` = "8ac557c0-4753-9d75-dae2-595e07334efe"
AND saved_search.assigned_user_id <> users.id
Replace that “8ac557c0-4753-9d75-dae2-595e07334efe” with whatever id your search has (or change the WHERE clause to use the saved search “name” if you prefer, as long as there is a single search with that name across all users).
This will create a new saved_search for each user found in the “users” table, by copying the saved_search you specify.
I’ll have to make a blog post with this one day…