add SELECT Case
create changelog table for mysql
bugfix on foreign key