-- unit_tests --gtest_filter=FaviconDatabaseTest.WildSchema
--
-- [meta] table has first column [oey] instead of [key] (single-bit
-- error). Database consistent with v6, but that may just mean that
-- v6 code was when attempting to work with an empty database with a
-- broken [meta] table. Multiple reports from the same clientid have
-- seen this, so the broken [meta] is almost certainly on disk.
--
-- TODO(shess): This is clearly low-priority BUT the general class of
-- problem where the schema is wrong should be handled. I suspect the
-- final solution will be to Raze() if the database contains [meta]
-- but the version cannot be fetched from it, or failing some other
-- validity metric.
BEGIN TRANSACTION;
CREATE TABLE meta(oey LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR);
CREATE TABLE "favicons" (id INTEGER PRIMARY KEY,url LONGVARCHAR NOT NULL,icon_type INTEGER DEFAULT 1,sizes LONGVARCHAR);
CREATE INDEX favicons_url ON favicons(url);
CREATE TABLE icon_mapping(id INTEGER PRIMARY KEY,page_url LONGVARCHAR NOT NULL,icon_id INTEGER);
CREATE INDEX icon_mapping_icon_id_idx ON icon_mapping(icon_id);
CREATE INDEX icon_mapping_page_url_idx ON icon_mapping(page_url);
CREATE TABLE favicon_bitmaps(id INTEGER PRIMARY KEY,icon_id INTEGER NOT NULL,last_updated INTEGER DEFAULT 0,image_data BLOB,width INTEGER DEFAULT 0,height INTEGER DEFAULT 0);
CREATE INDEX favicon_bitmaps_icon_id ON favicon_bitmaps(icon_id);
COMMIT;