SQL Indexes with Database.Persist (Yesod Web Environment)

Database.Persist seems to be an aggregated index. This is normal, I can create my own indexes, but as a rule, when creating and deleting tables, when creating and deleting fields, a general SQL migration is created. It also leads to a decrease in the index.

Is there a recommended way to make sure they migrate the database migration?

+4
source share
1 answer

Only a SQLite3 database should drop tables; PostgreSQL and MySQL provide powerful ALTER TABLE statements to avoid this. Therefore, indexes should only be lost for SQLite3. If you use SQLite3 in production (not recommended), you have two options:

  • Turn off automatic migration and process the scheme yourself.
  • Add code after starting the migration to replace the missing indexes.
+7
source

All Articles