function createDatabase(schemaSpec) {
    const { tables: tableSpecs } = schemaSpec;
    const tables = Object.entries(tableSpecs).reduce(
        (map, [tableName, tableSpec]) => ({
            ...map,
            [tableName]: new Table(tableSpec),
        }),
        {}
    );

    const getEmptyState = () =>
        Object.entries(tables).reduce(
            (map, [tableName, table]) => ({
                ...map,
                [tableName]: table.getEmptyState(),
            }),
            BASE_EMPTY_STATE
        );

    return {
        getEmptyState,
        query: query.bind(null, tables),
        update: update.bind(null, tables),
        // Used to inspect the schema.
        describe: (tableName) => tables[tableName],
    };
}
@memberof db
@param {Object} schemaSpec
@return Object database