fixed schema IDs attached to database

now works with database restrictions.