discourse/script
Andrei Prigorshnev 1656b7ed01
DEV: Make db_timestamp_mover work with tables with unique constraints (#14027)
Some tables in the database have constraints on columns with dates. Because of them, the script for moving timestamps can fail from time to time. This PR makes the script work with such tables.

In general, in PostgreSQL it is not always possible to defer constraint checks to the transaction commit (Primary Keys and Unique Constraints can be deferred, but them should be declared as DEFERRABLE to make it possible. Indices created with CREATE UNIQUE INDEX can't be deferred at all).

Since we can't defer constraint checks, I've made it work using a little hack. For example, if we need to move all timestamps by one day, the script will move timestamps by 1000 years and one day, and then return timestamps back by 1000 years. The script use this hack only for columns that have unique constraints.
2021-08-12 19:24:21 +04:00
..
benchmarks DEV: Correct typos and spelling mistakes (#12812) 2021-05-21 11:43:47 +10:00
bulk_import DEV: Add vBulletin5 bulk importer (#12904) 2021-04-30 11:03:33 -05:00
demon_test
import_scripts DEV: minor improvements in the vanilla import script. (#14026) 2021-08-12 15:07:44 +05:30
.gitignore
alice.txt
analyze_sidekiq_queues.rb
bench.rb
biggest_objects.rb
boot_mem.rb
cache_critical_dns DEV: Support env var for prometheus port in cache_critical_dns 2020-08-17 15:48:14 -04:00
check_forking.rb
compile_hbs.rb
copyright-deposit
db_timestamps_mover.rb DEV: Make db_timestamp_mover work with tables with unique constraints (#14027) 2021-08-12 19:24:21 +04:00
diff_heaps.rb
discourse FIX: typo in discourse 2021-06-30 11:08:29 -04:00
docker_test.rb DEV: Remove the remaining Travis code (#13255) 2021-06-02 20:29:47 +02:00
downsize_uploads.rb DEV: Improve `script/downsize_uploads.rb` (#13508) 2021-06-24 00:09:40 +02:00
i18n_lint.rb DEV: Clean up and refactor CI workflow(s) (#12144) 2021-02-22 10:28:32 +01:00
measure.rb
memory-analysis
memstats.rb
micro_bench.rb
mwrap_sidekiq
profile_db_generator.rb
promote_migrations DEV: Update script/promote_migrations (#13513) 2021-06-24 13:57:23 +01:00
rails
redis_memory.rb
require_profiler.rb
spawn_backup_restore.rb FIX: Killing a Unicorn worker shouldn't kill a running backup or restore process 2020-10-13 19:48:53 +02:00
switch_container_ruby
test_email_settings.rb
test_hbs_compiler.rb
test_mem.rb
test_memory_leak.rb
test_pretty_text.rb
thread_detective.rb
user_simulator.rb