It hurts if server has millions of tables.

See https://github.com/ClickHouse/ClickHouse/pull/3398
Please add some tests to ensure it won't be broken in future.
{
    ASTPtr ast;
    auto settings = global_context.getSettingsRef();
    auto metadata_dir_path = getMetadataPath();
    auto database_metadata_path = metadata_dir_path.substr(0, metadata_dir_path.size() - 1) + ".sql";
    ast = getCreateQueryFromMetadata(database_metadata_path, true);
    if (!ast)
    {
        
        
        String query = "CREATE DATABASE " + backQuoteIfNeed(getDatabaseName()) + " ENGINE = Ordinary";
        ParserCreateQuery parser;
        ast = parseQuery(parser, query.data(), query.data() + query.size(), "", 0, settings.max_parser_depth);
    }
    return ast;
}
void DatabaseOnDisk::drop(const Context & context)
{
    Poco::File(context.getPath() + getDataPath()).remove(false);
    Poco::File(getMetadataPath()).remove(false);
}
String DatabaseOnDisk::getObjectMetadataPath(const String & object_name) const
{
    return getMetadataPath() + escapeForFileName(object_name) + ".sql";
}
time_t DatabaseOnDisk::getObjectMetadataModificationTime(const String & object_name) const