feat: migrate indexes

This commit is contained in:
Gregor Kleen 2020-08-02 10:27:50 +02:00
parent 88a92390d5
commit dfe68d5924

View File

@ -71,6 +71,7 @@ migrateAll' :: Migration
migrateAll' = sequence_ migrateAll' = sequence_
[ migrateUniWorX [ migrateUniWorX
, migrateMemcachedSqlStorage , migrateMemcachedSqlStorage
, migrateManual
] ]
migrateAll :: ( MonadLogger m migrateAll :: ( MonadLogger m
@ -137,6 +138,27 @@ getMissingMigrations = do
appliedMigrations <- selectKeysList [] [] appliedMigrations <- selectKeysList [] []
return $ customMigrations `Map.withoutKeys` Set.fromList appliedMigrations return $ customMigrations `Map.withoutKeys` Set.fromList appliedMigrations
migrateManual :: Migration
migrateManual =
addMigrations
[ (False, "CREATE INDEX IF NOT EXISTS course_application_file_content ON course_application_file (content)")
, (False, "CREATE INDEX IF NOT EXISTS material_file_content ON material_file (content)")
, (False, "CREATE INDEX IF NOT EXISTS course_news_file_content ON course_news_file (content)")
, (False, "CREATE INDEX IF NOT EXISTS sheet_file_content ON sheet_file (content)")
, (False, "CREATE INDEX IF NOT EXISTS course_app_instruction_file_content ON course_app_instruction_file (content)")
, (False, "CREATE INDEX IF NOT EXISTS allocation_matching_log ON allocation_matching (log)")
, (False, "CREATE INDEX IF NOT EXISTS submission_file_content ON submission_file (content)")
, (False, "CREATE INDEX IF NOT EXISTS session_file_content ON session_file (content)")
, (False, "CREATE INDEX IF NOT EXISTS file_lock_content ON file_lock (content)")
, (False, "CREATE INDEX IF NOT EXISTS user_lower_display_email ON \"user\" (lower(display_email))")
, (False, "CREATE INDEX IF NOT EXISTS user_lower_email ON \"user\" (lower(email))")
, (False, "CREATE INDEX IF NOT EXISTS user_lower_ident ON \"user\" (lower(ident))")
, (False, "CREATE INDEX IF NOT EXISTS submission_sheet ON submission (sheet)")
, (False, "CREATE INDEX IF NOT EXISTS submission_edit_submission ON submission_edit (submission)")
]
{- {-
Confusion about quotes, from the PostgreSQL Manual: Confusion about quotes, from the PostgreSQL Manual:
Single quotes for string constants, double quotes for table/column names. Single quotes for string constants, double quotes for table/column names.
@ -145,7 +167,6 @@ getMissingMigrations = do
#{anything} (escaped as value); #{anything} (escaped as value);
-} -}
customMigrations :: forall m. customMigrations :: forall m.
MonadResource m MonadResource m
=> Map (Key AppliedMigration) (ReaderT SqlBackend m ()) => Map (Key AppliedMigration) (ReaderT SqlBackend m ())