Implement CIText as NOCASE alternative in postgresql

This commit is contained in:
Tim Möhlmann
2018-11-20 14:41:17 +02:00
parent 9b9f3731f6
commit 0f3c1b9d15
9 changed files with 60 additions and 16 deletions

View File

@@ -7,7 +7,7 @@ RUN apk add --no-cache \
RUN pip3 install jinja2
# Image specific layers under this line
RUN apk add --no-cache \
postgresql postgresql-libs \
postgresql postgresql-libs postgresql-contrib \
&& apk add --virtual .build-deps gcc musl-dev postgresql-dev python3-dev \
&& pip3 install psycopg2 anosql \
&& apk --purge del .build-deps

View File

@@ -34,3 +34,10 @@ select 1
create
database mailu
owner mailu;
-- name: create_citext!
-- Install the CIText extension
create
extension
if not exists
citext;

View File

@@ -7,7 +7,7 @@ import glob
import os
def setup():
conn = psycopg2.connect('user=postgres')
conn = psycopg2.connect(user = 'postgres')
queries = anosql.load_queries('postgres', '/conf/queries.sql')
# Mailu user
queries.create_mailu_user(conn)
@@ -21,6 +21,10 @@ def setup():
queries.create_db(conn)
conn.set_isolation_level(1)
conn.close()
conn = psycopg2.connect(user = 'postgres', database= 'mailu')
queries.create_citext(conn)
conn.commit()
conn.close()
# Bootstrap the database if postgresql is running for the first time
if not os.path.exists('/var/lib/postgresql/data/pg_wal'):