discourse/db
Krzysztof Kotlarek 14003abc37
FIX: Improve allowed_path column migration (#10321)
Because previous migration was already deployed and some databases were already migrated, I needed to add some conditions to the migration.

Previous migration - https://github.com/discourse/discourse/blob/master/db/post_migrate/20200629232159_rename_path_whitelist_to_allowed_paths.rb

What will happen in a scenario when previous migration was not run.
1. column allowed_paths will be created
2. allowed_path will be populated with data from path_whitelist
3. path_whitelist column will be dropped

What will happen in a scenario when previous migration was already run.
1. column allowed_paths will not be created because already exists - `unless column_exists?(:embeddable_hosts, :allowed_paths)`
2. Data will not be copied because path_whitelist is missing - `if column_exists?(:embeddable_hosts, :path_whitelist) && column_exists?(:embeddable_hosts, :allowed_paths)`
3. path_whitelist column deletion will be skipped - `if column_exists?(:embeddable_hosts, :path_whitelist)`
2020-07-28 13:31:51 +10:00
..
fixtures FIX: Use a mutex when reseting column information while seeding. 2020-06-23 09:15:47 +08:00
migrate FIX: Improve allowed_path column migration (#10321) 2020-07-28 13:31:51 +10:00
post_migrate FIX: Improve allowed_path column migration (#10321) 2020-07-28 13:31:51 +10:00
api_test_seeds.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00