I am using a migration file to add some indexes. W...
# prisma-migrate
s
I am using a migration file to add some indexes. When I apply the migration (with prisma migrate dev), it creates another migration file where it drops the Indexes again… how can I add custom indexes?
j
You run the migration with
migrate deploy
.
And then next time you use
migrate dev --create-only
you need to remove the indexes again.
Are these indexes unsupported by Prisma? What is special about them?
s
They use the pg_trgm extension
Copy code
CREATE INDEX index_on_profile_name_trigram ON "Profile" using gin (name gin_trgm_ops);
Why do I have to remove the indexes again?
I want them to persist
j
Sorry, that was unclear - you have to remove the "removal of those indexes" again.
As they are not in the Prisma Schema, Prisma Migrate will try to keep removing them.
Please create an issue for these special indexes as a feature request so we can actually add support for them in the Prisma Schema and Prisma Migrate.
thanks for looking into it
I also added, that it causes a drift, and so removes all my database content
j
The drift is weird - as it makes the workaround impossible - we will try to reproduce that.
s
Thank you 🙂