Sha256: 1190d3ab3f9e075b081279d7da6714ecd35e95afcb5b228cbf0626160d84d829
Contents?: true
Size: 871 Bytes
Versions: 19
Compression:
Stored size: 871 Bytes
Contents
module NulogyMessageBusProducer # This modules repopulates the replication slot (what debezium uses to populate Kafka) # by re-generating the subscription events module RepopulateReplicationSlots def self.repopulate table_name = NulogyMessageBusProducer::SubscriptionEvent.table_name temp_table_name = "#{NulogyMessageBusProducer::SubscriptionEvent.table_name}_tmp_event_repopulation" ActiveRecord::Base.connection.execute(<<~SQL) BEGIN; LOCK TABLE #{table_name} IN SHARE MODE; DROP TABLE IF EXISTS #{temp_table_name}; CREATE TEMPORARY TABLE #{temp_table_name} AS SELECT * FROM #{table_name} ORDER BY created_at ASC; TRUNCATE #{table_name}; INSERT INTO #{table_name} (SELECT * FROM #{temp_table_name} ORDER BY created_at ASC); COMMIT; SQL end end end
Version data entries
19 entries across 19 versions & 1 rubygems