Created
April 23, 2024 10:46
-
-
Save rolfschmidt/e86a4c049dc2ed0c81df4322acd22ef1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| prod_mode = false | |
| if ARGV[0].present? | |
| prod_mode = true | |
| puts "PROD MODE ON!!!" | |
| sleep 2 | |
| end | |
| Store.where("o_id LIKE '%.0'").find_each do |st| | |
| nv = st.o_id.sub(/\.0$/, '') | |
| puts "Change store object #{st.id} (#{st.store_object.name}) o_id from #{st.o_id} to #{nv}" | |
| if prod_mode | |
| st.update_columns(o_id: nv) | |
| puts "done..." | |
| end | |
| end | |
| puts "Broken store object count after execution: #{Store.where("o_id LIKE '%.0'").count} or regex search (#{Store.where(%Q(o_id !~ '^[0-9]+$')).count})" | |
| Rails.cache.clear |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment