We have a system where we have for each division a database , currently we have 20+ divisions.
So when we have to update / delete / alter / new table we have to go threw all of those database and run the queries .
Sometime people don't follow procedures (always ?) and we end up having structures that aren't updated .
I was looking into a way to lunch the same queries on all database without having to use bash or external scripts .
So here is some of the stuff that i found :
CALL FOR EACH("SELECT databases WHERE `DATABASE` LIKE 'division_%'" , ${1});
where i could enter a query in the ${1}
or this (less dynamic):
call $('{a, b}' , 'ALTER TABLE division_${1}.caching ADD COLUMN notes VARCHAR(4096) CHARSET utf8'');
But this gives me "No database Selected"
Any idea on how to proceed with this situation ?