1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
-- Database schema 2 adds the ability to save recipes as favorites.
CREATE TABLE recipes_new (
id INTEGER PRIMARY KEY,
title TEXT NOT NULL,
portions INTEGER NOT NULL,
url TEXT NOT NULL,
notes TEXT NOT NULL,
created INTEGER NOT NULL, -- Unix time stamp
last_changed INTEGER NOT NULL, -- Unix time stamp
is_favorite BOOLEAN NOT NULL DEFAULT FALSE
);
INSERT INTO
recipes_new
(id, title, portions, url, notes, created, last_changed, is_favorite)
SELECT
id, title, portions, url, notes, created, last_changed, FALSE
FROM recipes;
DROP TABLE recipes;
ALTER TABLE recipes_new RENAME TO recipes;
UPDATE
metadata
SET
value = '3'
WHERE
key = 'schema_version';
|