You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 14, 2024. It is now read-only.
I spent some time trying to figure this out, and turned out to be very simple. Unfortunately I couldn't find any documentation for this. I hope writing some doc here will help anyone else searching for this.
Using raw SQL in migrations is as simple as using Migration.get_connection().statement().
For example, to use some Postgres-specific features like text search one can do something like this:
classAddTextSearchIndex(Migration):
defup(self):
self.get_connection().statement(''' CREATE INDEX ts_idx ON mytable USING GIN (to_tsvector('english', column)); ''')
defdown(self):
self.get_connection().statement(''' DROP INDEX ts_idx; ''')
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I spent some time trying to figure this out, and turned out to be very simple. Unfortunately I couldn't find any documentation for this. I hope writing some doc here will help anyone else searching for this.
Using raw SQL in migrations is as simple as using
Migration.get_connection().statement()
.For example, to use some Postgres-specific features like text search one can do something like this:
The text was updated successfully, but these errors were encountered: