Added more robust permission checking for database.php.
Added schema.