-- Add column visits to, and update table version to 2
ALTER TABLE `apps` ADD COLUMN `visits` INTEGER DEFAULT 0;
-- Add column to show small icon
ALTER TABLE `apps` ADD COLUMN `small_icon` VARCHAR(1024) DEFAULT NULL;

-- Update metadata.version, the value should be same as the version in file name.
INSERT OR REPLACE INTO `metadata` (`key`, `value`) VALUES ('version', 2);

-- Update small icons
UPDATE `apps` SET `small_icon` = 'chrome://livemargins/skin/images/icons/gallery.png' WHERE `uid` = 'app_gallery';
UPDATE `apps` SET `small_icon` = 'chrome://livemargins/skin/images/icons/sina.ico'    WHERE `uid` = 'app_music';
UPDATE `apps` SET `small_icon` = 'chrome://livemargins/skin/images/icons/douban.ico'  WHERE `uid` = 'app_radio';
UPDATE `apps` SET `small_icon` = 'chrome://livemargins/skin/images/icons/search.png'  WHERE `uid` = 'app_search';
UPDATE `apps` SET `small_icon` = 'chrome://livemargins/skin/images/icons/stock.png'   WHERE `uid` = 'app_stock';
UPDATE `apps` SET `small_icon` = 'chrome://livemargins/skin/images/icons/taobao.png'  WHERE `uid` = 'app_taobao';
UPDATE `apps` SET `small_icon` = 'chrome://livemargins/skin/images/icons/tv.png'      WHERE `uid` = 'app_tv';
UPDATE `apps` SET `small_icon` = 'chrome://livemargins/skin/images/icons/weather.png' WHERE `uid` = 'app_weather';
UPDATE `apps` SET `small_icon` = 'chrome://livemargins/skin/images/icons/focus.png'   WHERE `uid` = 'app_focus';
UPDATE `apps` SET `small_icon` = 'chrome://livemargins/skin/images/icons/shopping.png' WHERE `uid` = 'app_shopping';
