aboutsummaryrefslogtreecommitdiff
path: root/database
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-01-13 18:34:54 +0100
committerneodarz <neodarz@neodarz.net>2019-01-13 18:34:54 +0100
commit07cc1fdc7e79468a6e8d9b53048712b652f8da84 (patch)
treebb668d7e82684d40972c078b089499e7e1919146 /database
parent6648b7f66836d630b5b3ef5399c4c0cf4fb6f65b (diff)
downloadkhanindexer-07cc1fdc7e79468a6e8d9b53048712b652f8da84.tar.xz
khanindexer-07cc1fdc7e79468a6e8d9b53048712b652f8da84.zip
Migrate to PostgreSQL
Diffstat (limited to 'database')
-rw-r--r--database/models.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/database/models.py b/database/models.py
index c731a08..2f9528a 100644
--- a/database/models.py
+++ b/database/models.py
@@ -1,9 +1,8 @@
-from peewee import Model, CharField, SqliteDatabase
+from peewee import Model, CharField, TextField, PostgresqlDatabase
import config
-db = SqliteDatabase(config.DATABASE)
-db.connect()
+db = PostgresqlDatabase(config.DB, host=config.DB_HOST, port=config.DB_PORT, user=config.DB_USER, password=config.DB_PASS, autocommit=True, autorollback=True)
class Page(Model):
"""
@@ -11,7 +10,7 @@ class Page(Model):
"""
url = CharField()
title = CharField(null=True)
- content = CharField(null=True)
+ content = TextField(null=True)
class Meta:
database = db