diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2013-09-17 21:44:00 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2013-09-17 21:44:00 -0400 |
| commit | fdd2199d01c46416a9befb537d882d83836b6243 (patch) | |
| tree | 932e273a61743edf1a94de57c9b3b872afe15e2c | |
| parent | d237f6a3d075f5731b56d15b12fc028fc035960d (diff) | |
| download | famille-flask-fdd2199d01c46416a9befb537d882d83836b6243.tar.gz | |
Update schema of the database
since sqlite3 doesn't have support for alter besides renaming a table
we use some sed fu to fix the dump
| -rwxr-xr-x | fix_database.sh | 7 | ||||
| -rw-r--r-- | schema.sql | 32 |
2 files changed, 23 insertions, 16 deletions
diff --git a/fix_database.sh b/fix_database.sh new file mode 100755 index 0000000..3427233 --- /dev/null +++ b/fix_database.sh @@ -0,0 +1,7 @@ +#!/bin/bash +echo '.dump'|sqlite3 famille.db>famille.sql +sed -i -e 's/string/text/' \ + -e 's/address_line1/address\_line1 text/' \ + -e 's/address_line2/address\_line2 text/' \ + -e 's/address_city_line/address_city_line text/' famille.sql +sqlite3 famille-fixed.db<famille.sql @@ -1,28 +1,28 @@ drop table if exists users; create table users ( id integer primary key autoincrement, - user_name string not null, - password string not null, + user_name text not null, + password text not null, last_seen timestamp default CURRENT_TIMESTAMP, - birthday string, - nameday string, + birthday text, + nameday text, notify boolean default 1, - email string, - phone string, - address_line1, - address_line2, - address_city_line, - timezone string, - kado string + email text, + phone text, + address_line1 text, + address_line2 text, + address_city_line text, + timezone text, + kado text ); drop table if exists news; create table news ( id integer primary key autoincrement, - title string not null, + title text not null, date timestamp default CURRENT_TIMESTAMP, - content string not null, - content_cache string not null, + content text not null, + content_cache text not null, user_id integer, FOREIGN KEY(user_id) REFERENCES users(id) ); @@ -31,8 +31,8 @@ drop table if exists comments; create table comments ( id integer primary key autoincrement, date timestamp default CURRENT_TIMESTAMP, - content string, - content_cache string not null, + content text, + content_cache text not null, user_id integer, news_id integer, FOREIGN KEY(user_id) REFERENCES users(id), |
