Add script to safely merge daria databases (#2444)
Add script to safely merge daria databases (#2444)

* add major frame and structure of a script that will safely merge daria tables together

* convert keys on the fly in versions

* make a rake task, start really troubleshooting

* core non pt objs looking good

* mass insert strat

* more or less this does what it's supposed to

* everything except versions

* note for later

* it works, including events. timezone not respected though

* postgres thinks everything is in utc. it is actually in eastern (timestamp no time zone datatype). force all utc timezones to eastern

* Apply suggestions from code review

Co-authored-by: Kat Tipton <b42e00276a9b59da9c4c6f2c915cddc1dae86abb@gmail.com>

* more useful comment, remove last_edited_by_id

* Apply suggestions from code review

Co-authored-by: Kat Tipton <b42e00276a9b59da9c4c6f2c915cddc1dae86abb@gmail.com>

* remove keyset var, private method the check of whether or not we should rewrite the fkey

* handle case of zero anything, like archived patients

* correct var madness

Co-authored-by: Kat Tipton <b42e00276a9b59da9c4c6f2c915cddc1dae86abb@gmail.com>
colinxfleming/dcaf_case_management,colinxfleming/dcaf_case_management,colinxfleming/dcaf_case_management,Kevin-Wei/dcaf_case_management,Kevin-Wei/dcaf_case_management,Kevin-Wei/dcaf_case_management,colinxfleming/dcaf_case_management,Kevin-Wei/dcaf_case_management