Skip to content

Commit f89cd80

Browse files
aagrawalrtslAyushi Agrawal
andauthored
adding an initializer preventing create partition statements from get… (#5737)
…ting into structure.sql **Story card:** [sc-17444](https://app.shortcut.com/simpledotorg/story/17444/exclude-reporting-patient-states-partitions-from-appearing-into-structure-sql) ## Because We have a partitioned table reporting_patient_states. Every time we do a reporting refresh, partitions gets created dynamically on this table (if they don't already exist). These partitions appear on structure.sql as well with something like CREATE TABLE simple_reporting.reporting_patient_states_20180101 ( These create partition statements are not really needed in structure.sql because These partitions are created dynamically through the rake task, if one doesn't exist Having a create statement for each partition makes the file very messy and unnecessarily long. We need to get rid of these create statements from getting into the file. ## This addresses Adding an initializer which has 'exclude-table' param to ignore these partition create statements from appearing into dump ## Test instructions Run rake db:refresh_reporting_views - this will create some partitions on reporting_patient_states Run rails db:migrate Verify structure.sql, create with individual partitions should not be a part of it. --------- Co-authored-by: Ayushi Agrawal <[email protected]>
1 parent d45eb6a commit f89cd80

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ActiveRecord::Tasks::DatabaseTasks.structure_dump_flags = [
2+
"--exclude-table=simple_reporting.reporting_patient_states_*"
3+
]

0 commit comments

Comments
 (0)