I have table _house with field 'soft_delete' default is 0.
Then I have a View to check undeleted entries, hence I have
CREATE VIEW house AS
SELECT * FROM _house where soft_delete = 0;
But the problem now is that everytime I modify table _house, I'll need to re-update my view so that is not broken.
So each time after modify table _house, I execute
ALTER VIEW house AS
SELECT * FROM _house where soft_delete = 0;
I wanted to find an easier way to execute above alter script, so I tried to create a procedure/function with 'alter view' inside, but mysql seems to prohibit me doing that.
The view definition is “frozen” at creation time, so changes to the underlying tables afterward do not affect the view definition. For example, if a view is defined as SELECT * on a table, new columns added to the table later do not become part of the view.