-- Create indexes
CREATE INDEX IF NOT EXISTS `apps_type`     ON `apps`(`type`);
CREATE INDEX IF NOT EXISTS `apps_bookmark` ON `apps`(`bookmark`);
CREATE INDEX IF NOT EXISTS `apps_position` ON `apps`(`position`);
CREATE INDEX IF NOT EXISTS `apps_visits`   ON `apps`(`visits`);

CREATE INDEX IF NOT EXISTS `app_info_auto_start`  ON `app_info`(`auto_start`);
CREATE INDEX IF NOT EXISTS `app_info_app_id`      ON `app_info`(`app_id`);
CREATE INDEX IF NOT EXISTS `app_info_last_opened` ON `app_info`(`last_opened`);

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