aboutsummaryrefslogtreecommitdiffhomepage
path: root/install
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas.loeuillet@gmail.com>2013-08-07 10:41:26 -0700
committerNicolas Lœuillet <nicolas.loeuillet@gmail.com>2013-08-07 10:41:26 -0700
commit01c0e050ad8eca54f115dfa21db99e4f61ab7ca7 (patch)
treee1bdacb68b3a56644f4525974844dd954d6e3c6b /install
parentda2c5d6fc33587c775a7d8a738c2c18de41f83b2 (diff)
parent339d510fda0a43b08981309f7540acedf3a4976c (diff)
downloadwallabag-01c0e050ad8eca54f115dfa21db99e4f61ab7ca7.tar.gz
wallabag-01c0e050ad8eca54f115dfa21db99e4f61ab7ca7.tar.zst
wallabag-01c0e050ad8eca54f115dfa21db99e4f61ab7ca7.zip
Merge pull request #104 from inthepoche/twig
Twig version on dev branch
Diffstat (limited to 'install')
-rw-r--r--install/mysql.sql34
-rwxr-xr-xinstall/poche.sqlitebin0 -> 294912 bytes
-rw-r--r--install/postgres.sql30
-rw-r--r--install/update_sqlite_from_0_to_1.php64
4 files changed, 128 insertions, 0 deletions
diff --git a/install/mysql.sql b/install/mysql.sql
new file mode 100644
index 00000000..cb232a84
--- /dev/null
+++ b/install/mysql.sql
@@ -0,0 +1,34 @@
1CREATE TABLE IF NOT EXISTS `config` (
2 `id` int(11) NOT NULL AUTO_INCREMENT,
3 `name` varchar(255) NOT NULL,
4 `value` varchar(255) NOT NULL,
5 PRIMARY KEY (`id`)
6) ENGINE=InnoDB DEFAULT CHARSET=latin1;
7
8CREATE TABLE IF NOT EXISTS `entries` (
9 `id` int(11) NOT NULL AUTO_INCREMENT,
10 `title` varchar(255) NOT NULL,
11 `url` varchar(255) NOT NULL,
12 `is_read` tinyint(1) NOT NULL,
13 `is_fav` tinyint(1) NOT NULL,
14 `content` blob NOT NULL,
15 `user_id` int(11) NOT NULL,
16 PRIMARY KEY (`id`)
17) ENGINE=InnoDB DEFAULT CHARSET=latin1;
18
19CREATE TABLE IF NOT EXISTS `users` (
20 `id` int(11) NOT NULL AUTO_INCREMENT,
21 `username` varchar(255) NOT NULL,
22 `password` varchar(255) NOT NULL,
23 `name` int(255) NOT NULL,
24 `email` varchar(255) NOT NULL,
25 PRIMARY KEY (`id`)
26) ENGINE=InnoDB DEFAULT CHARSET=latin1;
27
28CREATE TABLE IF NOT EXISTS `users_config` (
29 `id` int(11) NOT NULL AUTO_INCREMENT,
30 `user_id` int(11) NOT NULL,
31 `name` varchar(255) NOT NULL,
32 `value` varchar(255) NOT NULL,
33 PRIMARY KEY (`id`)
34) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file
diff --git a/install/poche.sqlite b/install/poche.sqlite
new file mode 100755
index 00000000..45add0d7
--- /dev/null
+++ b/install/poche.sqlite
Binary files differ
diff --git a/install/postgres.sql b/install/postgres.sql
new file mode 100644
index 00000000..9e0e8276
--- /dev/null
+++ b/install/postgres.sql
@@ -0,0 +1,30 @@
1CREATE TABLE config (
2 id bigserial primary key,
3 name varchar(255) NOT NULL,
4 value varchar(255) NOT NULL
5);
6
7CREATE TABLE entries (
8 id bigserial primary key,
9 title varchar(255) NOT NULL,
10 url varchar(255) NOT NULL,
11 is_read boolean DEFAULT false,
12 is_fav boolean DEFAULT false,
13 content TEXT,
14 user_id integer NOT NULL
15);
16
17CREATE TABLE users (
18 id bigserial primary key,
19 username varchar(255) NOT NULL,
20 password varchar(255) NOT NULL,
21 name varchar(255) NOT NULL,
22 email varchar(255) NOT NULL
23);
24
25CREATE TABLE users_config (
26 id bigserial primary key,
27 user_id integer NOT NULL,
28 name varchar(255) NOT NULL,
29 value varchar(255) NOT NULL
30); \ No newline at end of file
diff --git a/install/update_sqlite_from_0_to_1.php b/install/update_sqlite_from_0_to_1.php
new file mode 100644
index 00000000..f3801eb1
--- /dev/null
+++ b/install/update_sqlite_from_0_to_1.php
@@ -0,0 +1,64 @@
1<?php
2
3$db_path = 'sqlite:../db/poche.sqlite';
4$handle = new PDO($db_path);
5$handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
6
7# Requêtes à exécuter pour mettre à jour poche.sqlite en 1.x
8
9# ajout d'un champ user_id sur la table entries
10$sql = 'ALTER TABLE entries RENAME TO tempEntries;';
11$query = $handle->prepare($sql);
12$query->execute();
13
14$sql = 'CREATE TABLE entries (id INTEGER PRIMARY KEY, title TEXT, url TEXT, is_read NUMERIC DEFAULT 0, is_fav NUMERIC DEFAULT 0, content BLOB, user_id NUMERIC);';
15$query = $handle->prepare($sql);
16$query->execute();
17
18$sql = 'INSERT INTO entries (id, title, url, is_read, is_fav, content) SELECT id, title, url, is_read, is_fav, content FROM tempEntries;';
19$query = $handle->prepare($sql);
20$query->execute();
21
22# Update tout pour mettre user_id = 1
23$sql = 'UPDATE entries SET user_id = 1;';
24$query = $handle->prepare($sql);
25$query->execute();
26
27# Changement des flags pour les lus / favoris
28$sql = 'UPDATE entries SET is_read = 1 WHERE is_read = -1;';
29$query = $handle->prepare($sql);
30$query->execute();
31
32$sql = 'UPDATE entries SET is_fav = 1 WHERE is_fav = -1;';
33$query = $handle->prepare($sql);
34$query->execute();
35
36# Création de la table users
37$sql = 'CREATE TABLE users (id INTEGER PRIMARY KEY, username TEXT, password TEXT, name TEXT, email TEXT);';
38$query = $handle->prepare($sql);
39$query->execute();
40
41$sql = 'INSERT INTO users (username) SELECT value FROM config WHERE name = "login";';
42$query = $handle->prepare($sql);
43$query->execute();
44
45$sql = "UPDATE users SET password = (SELECT value FROM config WHERE name = 'password')";
46$query = $handle->prepare($sql);
47$query->execute();
48
49# Création de la table users_config
50$sql = 'CREATE TABLE users_config (id INTEGER PRIMARY KEY, user_id NUMERIC, name TEXT, value TEXT);';
51$query = $handle->prepare($sql);
52$query->execute();
53
54# Suppression de la table temporaire
55$sql = 'DROP TABLE tempEntries;';
56$query = $handle->prepare($sql);
57$query->execute();
58
59# Vidage de la table de config
60$sql = 'DELETE FROM config;';
61$query = $handle->prepare($sql);
62$query->execute();
63
64echo 'welcome to poche 1.0 !'; \ No newline at end of file