Is it possible to apply trigger on any table in information_schema?
Is it possible to apply trigger on any table in in开发者_如何学Pythonformation_schema?
It is my understanding that the tables in information_schema are really views. This is mentioned here.
According to MySQL, you can't make triggers on temp tables or views. See this page for a discussion about that.
So, I'm going to say no based on that information. I'm sure someone will correct me if I'm wrong on this.
There is a discussion similar to what you are asking here.
What are you trying to accomplish?
Someone smarter is there -- Just kidding but I've been trying to do the same thing and the only obvious answer is to add an abstraction layer, unfortunately.
Simply put, instead of just SQL("ALTER TABLE ....") you will need to call a higher level function (written by yourself) in another language, like this:
->
modifytable( $old_table_structure,$new_table_structure){
alter_table_base_table($old_table_structure,$new_table_structure);
alter_table_history_table($old_table_structure,$new_table_structure); //just guessing that's what I'm doing with it so thought it was the same for you
alter_history_triggers($old_table_structure,$new_table_structure);
}
I really wanted to do this straight in the DBMS, but it seems like information_schema wasn't meant for that.
And of course, you'll want to have all that in one transaction, to make sure it doesn't explode ;)
精彩评论