Chromium Code Reviews| Index: components/offline_pages/offline_page_metadata_store_sql.cc |
| diff --git a/components/offline_pages/offline_page_metadata_store_sql.cc b/components/offline_pages/offline_page_metadata_store_sql.cc |
| index 93afcb30ad5c8c13231e1147ff692f840bbfbba1..3bddc6537a6c08d86612484a94e0ab014ca9f05f 100644 |
| --- a/components/offline_pages/offline_page_metadata_store_sql.cc |
| +++ b/components/offline_pages/offline_page_metadata_store_sql.cc |
| @@ -38,7 +38,7 @@ const char kOfflinePagesColumns[] = |
| // later use. We will treat NULL as "Unknown" in any subsequent queries |
| // for user_initiated values. |
| " user_initiated INTEGER," // this is actually a boolean |
| - " expiration_time INTEGER NOT NULL," |
| + " expiration_time INTEGER NOT NULL DEFAULT 0," |
| " client_namespace VARCHAR NOT NULL," |
| " client_id VARCHAR NOT NULL," |
| " online_url VARCHAR NOT NULL," |
| @@ -87,8 +87,14 @@ bool CreateSchema(sql::Connection* db) { |
| sql::Transaction transaction(db); |
| if (!transaction.Begin()) |
| return false; |
| - if (db->DoesTableExist(kOfflinePagesTable.table_name)) |
| + if (db->DoesTableExist(kOfflinePagesTable.table_name)) { |
| + if (!db->DoesColumnExist(OFFLINE_PAGES_TABLE_NAME, "expiration_time")) { |
| + return db->Execute( |
| + "ALTER TABLE" OFFLINE_PAGES_TABLE_NAME |
|
fgorski
2016/06/01 16:52:03
I think you need a space after TABLE
|
| + "ADD COLUMN expiration_time INTEGER NOT NULL DEFAULT 0"); |
|
fgorski
2016/06/01 16:52:04
and before ADD
|
| + } |
| return true; |
| + } |
| if (!CreateTable(db, kOfflinePagesTable)) |
| return false; |