From 4a978bada3accaeecb67a2490576610fa992c145 Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Sun, 24 Mar 2019 15:58:44 +0200 Subject: [PATCH] Fix: triggers not created for queries.search_vector (#3634) --- redash/cli/database.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/redash/cli/database.py b/redash/cli/database.py index 701103625f..ad78f7e5b3 100644 --- a/redash/cli/database.py +++ b/redash/cli/database.py @@ -1,5 +1,6 @@ import time +import sqlalchemy from flask.cli import AppGroup from flask_migrate import stamp from sqlalchemy.exc import DatabaseError @@ -25,6 +26,8 @@ def create_tables(): from redash.models import db _wait_for_db_connection(db) + # To create triggers for searchable models, we need to call configure_mappers(). + sqlalchemy.orm.configure_mappers() db.create_all() # Need to mark current DB as up to date