Sha256: a86da6e1eb6f6cf39c50e5ea6b904179ded119006c6d17346fd4201f3826a1de
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require "bundler/setup" require "active_partition" require "active_record" require "byebug" def reload! files = $LOADED_FEATURES.select { |feat| feat =~ /\/active_partition\// } files.each { |file| load file } end # You can add fixtures and/or initialization code here to make experimenting # with your gem easier. You can also use a different console, if you like. # (If you use this, don't forget to add pry to your Gemfile!) # require "pry" # Pry.start # Create test model class OutgoingEvent < ActiveRecord::Base include ActivePartition::Partitionable self.primary_key = "id" self.partitioned_by = "created_at" self.partition_range = 1.day # You can choose 1 of the following 2 options self.retention_period = 1.month self.retention_partition_count = 3 end class OutgoingEventsWebhook < ActiveRecord::Base include ActivePartition::Partitionable self.primary_key = "id" self.partitioned_by = "created_at" self.partition_range = 1.hour # You can choose 1 of the following 2 options self.retention_period = 1.day self.retention_partition_count = 3 end OutgoingEvent.establish_connection(ENV["DATABASE_URL"]) OutgoingEventsWebhook.establish_connection(ENV["DATABASE_URL"]) if OutgoingEventsWebhook.partition_adapter == OutgoingEvent.partition_adapter puts "Violate the partition adapter constraint", OutgoingEventsWebhook.partition_adapter == OutgoingEvent.partition_adapter puts OutgoingEventsWebhook.partition_adapter puts OutgoingEvent.partition_adapter end if OutgoingEventsWebhook.partition_manager == OutgoingEvent.partition_manager puts "Violate the partition manager constraint" puts OutgoingEventsWebhook.partition_manager puts OutgoingEvent.partition_manager end require "irb" IRB.start(__FILE__)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_partition-0.5.0 | bin/console |