blob: 04303092c46e07d3bcc0507d6d12a25069a1360e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import os
from django.db import connection, transaction
from django.conf import settings
import forum.models
if settings.USE_PG_FTS:
from django.db.models.signals import post_syncdb
def setup_pgfulltext(sender, **kwargs):
if sender == forum.models:
install_pg_fts()
post_syncdb.connect(setup_pgfulltext)
def install_pg_fts():
f = open(os.path.join(os.path.dirname(__file__), '../sql_scripts/pg_fts_install.sql'), 'r')
cursor = connection.cursor()
cursor.execute(f.read())
transaction.commit_unless_managed()
f.close()
|