nulogy_message_bus_producer 3.2.0 → 4.0.0.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +186 -25
  3. data/Rakefile +2 -4
  4. data/db/migrate/20200611150212_create_public_subscriptions_and_events_tables.rb +2 -2
  5. data/db/migrate/20210330204121_add_event_type_to_subscription_events.rb +9 -0
  6. data/lib/nulogy_message_bus_producer.rb +32 -12
  7. data/lib/nulogy_message_bus_producer/base_subscription.rb +1 -1
  8. data/lib/nulogy_message_bus_producer/config.rb +25 -1
  9. data/lib/nulogy_message_bus_producer/configuration/query_parser.rb +71 -0
  10. data/lib/nulogy_message_bus_producer/repopulate_replication_slots.rb +7 -5
  11. data/lib/nulogy_message_bus_producer/self_serve_subscription.rb +18 -0
  12. data/lib/nulogy_message_bus_producer/subscription_event.rb +3 -0
  13. data/lib/nulogy_message_bus_producer/subscriptions/configured_subscription.rb +14 -0
  14. data/lib/nulogy_message_bus_producer/subscriptions/finder.rb +40 -0
  15. data/lib/nulogy_message_bus_producer/subscriptions/no_variables.rb +43 -0
  16. data/lib/nulogy_message_bus_producer/subscriptions/postgres_transport.rb +11 -4
  17. data/lib/nulogy_message_bus_producer/subscriptions/query_validator.rb +47 -0
  18. data/lib/nulogy_message_bus_producer/subscriptions/risky_subscription_blocker.rb +17 -10
  19. data/lib/nulogy_message_bus_producer/subscriptions/valid_for_schema_validator.rb +14 -0
  20. data/lib/nulogy_message_bus_producer/version.rb +1 -1
  21. data/lib/tasks/engine/message_bus_producer.rake +4 -4
  22. data/spec/dummy/Rakefile +1 -1
  23. data/spec/dummy/app/mailers/application_mailer.rb +2 -2
  24. data/spec/dummy/bin/bundle +2 -2
  25. data/spec/dummy/bin/rails +3 -3
  26. data/spec/dummy/bin/rake +2 -2
  27. data/spec/dummy/bin/setup +10 -11
  28. data/spec/dummy/bin/update +10 -10
  29. data/spec/dummy/bin/yarn +6 -8
  30. data/spec/dummy/config.ru +1 -1
  31. data/spec/dummy/config/boot.rb +3 -3
  32. data/spec/dummy/config/database.yml +2 -2
  33. data/spec/dummy/config/environment.rb +1 -1
  34. data/spec/dummy/config/environments/development.rb +2 -2
  35. data/spec/dummy/config/environments/production.rb +5 -5
  36. data/spec/dummy/config/environments/test.rb +2 -2
  37. data/spec/dummy/config/initializers/assets.rb +2 -2
  38. data/spec/dummy/config/puma.rb +3 -3
  39. data/spec/dummy/config/spring.rb +2 -2
  40. data/spec/dummy/db/schema.rb +2 -1
  41. data/spec/dummy/log/development.log +321 -0
  42. data/spec/dummy/log/test.log +19061 -0
  43. data/spec/integration/lib/nulogy_message_bus_producer/config_spec.rb +37 -0
  44. data/spec/integration/lib/nulogy_message_bus_producer/repopulate_replication_slots_spec.rb +23 -14
  45. data/spec/integration/lib/nulogy_message_bus_producer/subscription_spec.rb +3 -59
  46. data/spec/integration/lib/nulogy_message_bus_producer/subscriptions/finder_spec.rb +54 -0
  47. data/spec/integration/lib/nulogy_message_bus_producer/subscriptions/no_variables_spec.rb +46 -0
  48. data/spec/integration/lib/nulogy_message_bus_producer/subscriptions/postgres_transport_spec.rb +99 -55
  49. data/spec/integration/lib/nulogy_message_bus_producer/{subscriber_graphql_schema_validator_spec.rb → subscriptions/query_validator_spec.rb} +5 -5
  50. data/spec/integration/lib/nulogy_message_bus_producer/subscriptions/risky_subscription_blocker_spec.rb +1 -19
  51. data/spec/integration/lib/nulogy_message_bus_producer_spec.rb +25 -0
  52. data/spec/integration_spec_helper.rb +0 -6
  53. data/spec/nulogy_message_bus_producer/configuration/query_parser_spec.rb +58 -0
  54. data/spec/nulogy_message_bus_producer/subscriptions/subscription_spec.rb +9 -0
  55. data/spec/spec_helper.rb +25 -1
  56. data/spec/support/kafka.rb +15 -9
  57. data/spec/support/kafka_connect.rb +1 -1
  58. data/spec/support/shared_examples/subscription_validations.rb +77 -0
  59. data/spec/support/spec_utils.rb +3 -2
  60. data/spec/support/sql_helpers.rb +9 -11
  61. data/spec/support/subscription_helpers.rb +22 -4
  62. data/spec/support/test_graphql_schema.rb +7 -0
  63. metadata +58 -38
  64. data/lib/nulogy_message_bus_producer/subscriber_graphql_schema_validator.rb +0 -45
  65. data/lib/nulogy_message_bus_producer/subscription.rb +0 -28
data/spec/dummy/bin/rails CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../config/application', __dir__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
2
+ APP_PATH = File.expand_path("../config/application", __dir__)
3
+ require_relative "../config/boot"
4
+ require "rails/commands"
data/spec/dummy/bin/rake CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
2
+ require_relative "../config/boot"
3
+ require "rake"
4
4
  Rake.application.run
data/spec/dummy/bin/setup CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
- require 'pathname'
3
- require 'fileutils'
4
- include FileUtils
2
+ require "pathname"
3
+ require "fileutils"
4
+ include FileUtils # rubocop:disable Style/MixinUsage
5
5
 
6
6
  # path to your application root.
7
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
7
+ APP_ROOT = Pathname.new File.expand_path("../../", __FILE__)
8
8
 
9
9
  def system!(*args)
10
10
  system(*args) || abort("\n== Command #{args} failed ==")
@@ -14,25 +14,24 @@ chdir APP_ROOT do
14
14
  # This script is a starting point to setup your application.
15
15
  # Add necessary setup steps to this file.
16
16
 
17
- puts '== Installing dependencies =='
18
- system! 'gem install bundler --conservative'
19
- system('bundle check') || system!('bundle install')
17
+ puts "== Installing dependencies =="
18
+ system! "gem install bundler --conservative"
19
+ system("bundle check") || system!("bundle install")
20
20
 
21
21
  # Install JavaScript dependencies if using Yarn
22
22
  # system('bin/yarn')
23
23
 
24
-
25
24
  # puts "\n== Copying sample files =="
26
25
  # unless File.exist?('config/database.yml')
27
26
  # cp 'config/database.yml.sample', 'config/database.yml'
28
27
  # end
29
28
 
30
29
  puts "\n== Preparing database =="
31
- system! 'bin/rails db:setup'
30
+ system! "bin/rails db:setup"
32
31
 
33
32
  puts "\n== Removing old logs and tempfiles =="
34
- system! 'bin/rails log:clear tmp:clear'
33
+ system! "bin/rails log:clear tmp:clear"
35
34
 
36
35
  puts "\n== Restarting application server =="
37
- system! 'bin/rails restart'
36
+ system! "bin/rails restart"
38
37
  end
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
- require 'pathname'
3
- require 'fileutils'
4
- include FileUtils
2
+ require "pathname"
3
+ require "fileutils"
4
+ include FileUtils # rubocop:disable Style/MixinUsage# rubocop:disable Style/MixinUsage
5
5
 
6
6
  # path to your application root.
7
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
7
+ APP_ROOT = Pathname.new File.expand_path("../../", __FILE__)
8
8
 
9
9
  def system!(*args)
10
10
  system(*args) || abort("\n== Command #{args} failed ==")
@@ -14,16 +14,16 @@ chdir APP_ROOT do
14
14
  # This script is a way to update your development environment automatically.
15
15
  # Add necessary update steps to this file.
16
16
 
17
- puts '== Installing dependencies =='
18
- system! 'gem install bundler --conservative'
19
- system('bundle check') || system!('bundle install')
17
+ puts "== Installing dependencies =="
18
+ system! "gem install bundler --conservative"
19
+ system("bundle check") || system!("bundle install")
20
20
 
21
21
  puts "\n== Updating database =="
22
- system! 'bin/rails db:migrate'
22
+ system! "bin/rails db:migrate"
23
23
 
24
24
  puts "\n== Removing old logs and tempfiles =="
25
- system! 'bin/rails log:clear tmp:clear'
25
+ system! "bin/rails log:clear tmp:clear"
26
26
 
27
27
  puts "\n== Restarting application server =="
28
- system! 'bin/rails restart'
28
+ system! "bin/rails restart"
29
29
  end
data/spec/dummy/bin/yarn CHANGED
@@ -1,11 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
- VENDOR_PATH = File.expand_path('..', __dir__)
2
+ VENDOR_PATH = File.expand_path("..", __dir__)
3
3
  Dir.chdir(VENDOR_PATH) do
4
- begin
5
- exec "yarnpkg #{ARGV.join(" ")}"
6
- rescue Errno::ENOENT
7
- $stderr.puts "Yarn executable was not detected in the system."
8
- $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9
- exit 1
10
- end
4
+ exec "yarnpkg #{ARGV.join(" ")}"
5
+ rescue Errno::ENOENT
6
+ warn "Yarn executable was not detected in the system."
7
+ warn "Download Yarn at https://yarnpkg.com/en/docs/install"
8
+ exit 1
11
9
  end
data/spec/dummy/config.ru CHANGED
@@ -1,5 +1,5 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require_relative 'config/environment'
3
+ require_relative "config/environment"
4
4
 
5
5
  run Rails.application
@@ -1,5 +1,5 @@
1
1
  # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
2
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
3
3
 
4
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
4
+ require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
5
+ $LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
@@ -5,8 +5,8 @@ defaults: &defaults
5
5
  adapter: postgresql
6
6
  username: <%= ENV['NULOGY_MESSAGE_BUS_PRODUCER_DATABASE_USER'] || "nulogy" %>
7
7
  password: <%= ENV['NULOGY_MESSAGE_BUS_PRODUCER_DATABASE_PASS'] || "Nulogy4Ever" %>
8
- host: <%= ENV['PM_DATABASE_HOST'] || "localhost" %>
9
- port: 5437
8
+ host: <%= ENV['DATABASE_HOST'] || "localhost" %>
9
+ port: 5438
10
10
  min_messages: warning
11
11
  schema_search_path: "\"$user\", public"
12
12
 
@@ -1,5 +1,5 @@
1
1
  # Load the Rails application.
2
- require_relative 'application'
2
+ require_relative "application"
3
3
 
4
4
  # Initialize the Rails application.
5
5
  Rails.application.initialize!
@@ -13,12 +13,12 @@ Rails.application.configure do
13
13
  config.consider_all_requests_local = true
14
14
 
15
15
  # Enable/disable caching. By default caching is disabled.
16
- if Rails.root.join('tmp/caching-dev.txt').exist?
16
+ if Rails.root.join("tmp/caching-dev.txt").exist?
17
17
  config.action_controller.perform_caching = true
18
18
 
19
19
  config.cache_store = :memory_store
20
20
  config.public_file_server.headers = {
21
- 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
21
+ "Cache-Control" => "public, max-age=#{2.days.seconds.to_i}"
22
22
  }
23
23
  else
24
24
  config.action_controller.perform_caching = false
@@ -11,7 +11,7 @@ Rails.application.configure do
11
11
  config.eager_load = true
12
12
 
13
13
  # Full error reports are disabled and caching is turned on.
14
- config.consider_all_requests_local = false
14
+ config.consider_all_requests_local = false
15
15
  config.action_controller.perform_caching = true
16
16
 
17
17
  # Attempt to read encrypted secrets from `config/secrets.yml.enc`.
@@ -21,7 +21,7 @@ Rails.application.configure do
21
21
 
22
22
  # Disable serving static files from the `/public` folder by default since
23
23
  # Apache or NGINX already handles this.
24
- config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
24
+ config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
25
25
 
26
26
  # Compress JavaScripts and CSS.
27
27
  config.assets.js_compressor = :uglifier
@@ -52,7 +52,7 @@ Rails.application.configure do
52
52
  config.log_level = :debug
53
53
 
54
54
  # Prepend all log lines with the following tags.
55
- config.log_tags = [ :request_id ]
55
+ config.log_tags = [:request_id]
56
56
 
57
57
  # Use a different cache store in production.
58
58
  # config.cache_store = :mem_cache_store
@@ -81,9 +81,9 @@ Rails.application.configure do
81
81
  # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
82
82
 
83
83
  if ENV["RAILS_LOG_TO_STDOUT"].present?
84
- logger = ActiveSupport::Logger.new(STDOUT)
84
+ logger = ActiveSupport::Logger.new($stdout)
85
85
  logger.formatter = config.log_formatter
86
- config.logger = ActiveSupport::TaggedLogging.new(logger)
86
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
87
87
  end
88
88
 
89
89
  # Do not dump schema after migrations.
@@ -15,11 +15,11 @@ Rails.application.configure do
15
15
  # Configure public file server for tests with Cache-Control for performance.
16
16
  config.public_file_server.enabled = true
17
17
  config.public_file_server.headers = {
18
- 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
18
+ "Cache-Control" => "public, max-age=#{1.hour.seconds.to_i}"
19
19
  }
20
20
 
21
21
  # Show full error reports and disable caching.
22
- config.consider_all_requests_local = true
22
+ config.consider_all_requests_local = true
23
23
  config.action_controller.perform_caching = false
24
24
 
25
25
  # Raise exceptions instead of rendering exception templates.
@@ -1,12 +1,12 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
3
  # Version of your assets, change this if you want to expire all your assets.
4
- Rails.application.config.assets.version = '1.0'
4
+ Rails.application.config.assets.version = "1.0"
5
5
 
6
6
  # Add additional assets to the asset load path.
7
7
  # Rails.application.config.assets.paths << Emoji.images_path
8
8
  # Add Yarn node_modules folder to the asset load path.
9
- Rails.application.config.assets.paths << Rails.root.join('node_modules')
9
+ Rails.application.config.assets.paths << Rails.root.join("node_modules")
10
10
 
11
11
  # Precompile additional assets.
12
12
  # application.js, application.css, and all non-JS/CSS in the app/assets
@@ -4,16 +4,16 @@
4
4
  # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
5
  # and maximum; this matches the default thread size of Active Record.
6
6
  #
7
- threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
7
+ threads_count = ENV.fetch("RAILS_MAX_THREADS", 5)
8
8
  threads threads_count, threads_count
9
9
 
10
10
  # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11
11
  #
12
- port ENV.fetch("PORT") { 3000 }
12
+ port ENV.fetch("PORT", 3000)
13
13
 
14
14
  # Specifies the `environment` that Puma will run in.
15
15
  #
16
- environment ENV.fetch("RAILS_ENV") { "development" }
16
+ environment ENV.fetch("RAILS_ENV", "development")
17
17
 
18
18
  # Specifies the number of `workers` to boot in clustered mode.
19
19
  # Workers are forked webserver processes. If using threads and workers together
@@ -1,6 +1,6 @@
1
- %w(
1
+ %w[
2
2
  .ruby-version
3
3
  .rbenv-vars
4
4
  tmp/restart.txt
5
5
  tmp/caching-dev.txt
6
- ).each { |path| Spring.watch(path) }
6
+ ].each { |path| Spring.watch(path) }
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 2020_10_05_164116) do
13
+ ActiveRecord::Schema.define(version: 2021_03_30_204121) do
14
14
 
15
15
  # These are extensions that must be enabled in order to support this database
16
16
  enable_extension "plpgsql"
@@ -23,6 +23,7 @@ ActiveRecord::Schema.define(version: 2020_10_05_164116) do
23
23
  t.uuid "company_uuid", null: false
24
24
  t.json "event_json", null: false
25
25
  t.datetime "created_at"
26
+ t.text "event_type"
26
27
  t.index ["created_at"], name: "index_nulogy_mb_producer_subscription_events_on_created_at"
27
28
  end
28
29
 
@@ -2230,3 +2230,324 @@ Migrating to CreateActiveStorageTables (20201005164116)
2230
2230
   (2.9ms) COMMIT
2231
2231
   (2.0ms) SELECT pg_advisory_unlock(3053653019973222135)
2232
2232
   (2.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2233
+  (1.2ms) CREATE DATABASE "nulogy_message_bus_producer_development" ENCODING = 'utf8'
2234
+  (1.8ms) CREATE DATABASE "nulogy_message_bus_producer_test" ENCODING = 'utf8'
2235
+  (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2236
+  (2.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2237
+  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2238
+  (1.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2239
+  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2240
+  (1.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2241
+ SQL (2.0ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
2242
+ SQL (1.3ms) CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
2243
+  (7.8ms) DROP TABLE IF EXISTS "message_bus_subscription_events" CASCADE
2244
+  (17.2ms) CREATE TABLE "message_bus_subscription_events" ("id" uuid NOT NULL PRIMARY KEY, "subscription_id" uuid NOT NULL, "partition_key" character varying NOT NULL, "topic_name" character varying NOT NULL, "company_uuid" uuid NOT NULL, "event_json" json NOT NULL, "created_at" timestamp)
2245
+  (3.0ms) CREATE INDEX "index_nulogy_mb_producer_subscription_events_on_created_at" ON "message_bus_subscription_events" ("created_at")
2246
+  (2.4ms) DROP TABLE IF EXISTS "message_bus_subscriptions" CASCADE
2247
+  (3.8ms) CREATE TABLE "message_bus_subscriptions" ("id" uuid NOT NULL PRIMARY KEY, "subscription_group_id" uuid NOT NULL, "event_type" character varying NOT NULL, "topic_name" character varying NOT NULL, "query" character varying NOT NULL, "schema_key" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2248
+  (2.3ms) CREATE INDEX "index_nulogy_mb_producer_subscriptions_on_event_type" ON "message_bus_subscriptions" ("event_type")
2249
+  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2250
+ ActiveRecord::InternalMetadata Load (1.5ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2251
+  (1.0ms) BEGIN
2252
+  (1.3ms) COMMIT
2253
+ ActiveRecord::InternalMetadata Load (1.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2254
+  (1.1ms) BEGIN
2255
+  (0.9ms) COMMIT
2256
+ SQL (1.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
2257
+ SQL (13.6ms) CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
2258
+  (2.4ms) DROP TABLE IF EXISTS "message_bus_subscription_events" CASCADE
2259
+  (17.5ms) CREATE TABLE "message_bus_subscription_events" ("id" uuid NOT NULL PRIMARY KEY, "subscription_id" uuid NOT NULL, "partition_key" character varying NOT NULL, "topic_name" character varying NOT NULL, "company_uuid" uuid NOT NULL, "event_json" json NOT NULL, "created_at" timestamp)
2260
+  (2.8ms) CREATE INDEX "index_nulogy_mb_producer_subscription_events_on_created_at" ON "message_bus_subscription_events" ("created_at")
2261
+  (1.1ms) DROP TABLE IF EXISTS "message_bus_subscriptions" CASCADE
2262
+  (4.7ms) CREATE TABLE "message_bus_subscriptions" ("id" uuid NOT NULL PRIMARY KEY, "subscription_group_id" uuid NOT NULL, "event_type" character varying NOT NULL, "topic_name" character varying NOT NULL, "query" character varying NOT NULL, "schema_key" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2263
+  (2.8ms) CREATE INDEX "index_nulogy_mb_producer_subscriptions_on_event_type" ON "message_bus_subscriptions" ("event_type")
2264
+  (4.7ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)
2265
+  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2266
+  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20201005164116)
2267
+  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES
2268
+ (20200611150212),
2269
+ (20201005150212);
2270
+
2271
+ 
2272
+  (4.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2273
+ ActiveRecord::InternalMetadata Load (1.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2274
+  (1.1ms) BEGIN
2275
+ ActiveRecord::InternalMetadata Create (1.4ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2020-10-08 19:11:47.210016"], ["updated_at", "2020-10-08 19:11:47.210016"]]
2276
+  (1.5ms) COMMIT
2277
+ ActiveRecord::InternalMetadata Load (1.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2278
+  (0.9ms) BEGIN
2279
+ ActiveRecord::InternalMetadata Update (1.1ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2020-10-08 19:11:47.218022"], ["key", "environment"]]
2280
+  (1.3ms) COMMIT
2281
+  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2282
+  (176.5ms) CREATE DATABASE "nulogy_message_bus_producer_development" ENCODING = 'utf8'
2283
+  (2.4ms) CREATE DATABASE "nulogy_message_bus_producer_test" ENCODING = 'utf8'
2284
+ SQL (2.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
2285
+ SQL (34.7ms) CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
2286
+  (2.2ms) DROP TABLE IF EXISTS "message_bus_subscription_events" CASCADE
2287
+  (12.0ms) CREATE TABLE "message_bus_subscription_events" ("id" uuid NOT NULL PRIMARY KEY, "subscription_id" uuid NOT NULL, "partition_key" character varying NOT NULL, "topic_name" character varying NOT NULL, "company_uuid" uuid NOT NULL, "event_json" json NOT NULL, "created_at" timestamp)
2288
+  (8.3ms) CREATE INDEX "index_nulogy_mb_producer_subscription_events_on_created_at" ON "message_bus_subscription_events" ("created_at")
2289
+  (1.5ms) DROP TABLE IF EXISTS "message_bus_subscriptions" CASCADE
2290
+  (6.1ms) CREATE TABLE "message_bus_subscriptions" ("id" uuid NOT NULL PRIMARY KEY, "subscription_group_id" uuid NOT NULL, "event_type" character varying NOT NULL, "topic_name" character varying NOT NULL, "query" character varying NOT NULL, "schema_key" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2291
+  (3.3ms) CREATE INDEX "index_nulogy_mb_producer_subscriptions_on_event_type" ON "message_bus_subscriptions" ("event_type")
2292
+  (5.6ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)
2293
+  (1.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2294
+  (2.0ms) INSERT INTO "schema_migrations" (version) VALUES (20201005164116)
2295
+  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES
2296
+ (20200611150212),
2297
+ (20201005150212);
2298
+
2299
+ 
2300
+  (5.6ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2301
+ ActiveRecord::InternalMetadata Load (1.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2302
+  (1.0ms) BEGIN
2303
+ ActiveRecord::InternalMetadata Create (2.4ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2021-03-09 17:25:53.335828"], ["updated_at", "2021-03-09 17:25:53.335828"]]
2304
+  (1.6ms) COMMIT
2305
+ ActiveRecord::InternalMetadata Load (2.5ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2306
+  (1.1ms) BEGIN
2307
+  (1.0ms) COMMIT
2308
+ SQL (2.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
2309
+ SQL (24.8ms) CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
2310
+  (2.0ms) DROP TABLE IF EXISTS "message_bus_subscription_events" CASCADE
2311
+  (30.7ms) CREATE TABLE "message_bus_subscription_events" ("id" uuid NOT NULL PRIMARY KEY, "subscription_id" uuid NOT NULL, "partition_key" character varying NOT NULL, "topic_name" character varying NOT NULL, "company_uuid" uuid NOT NULL, "event_json" json NOT NULL, "created_at" timestamp)
2312
+  (5.5ms) CREATE INDEX "index_nulogy_mb_producer_subscription_events_on_created_at" ON "message_bus_subscription_events" ("created_at")
2313
+  (1.3ms) DROP TABLE IF EXISTS "message_bus_subscriptions" CASCADE
2314
+  (6.6ms) CREATE TABLE "message_bus_subscriptions" ("id" uuid NOT NULL PRIMARY KEY, "subscription_group_id" uuid NOT NULL, "event_type" character varying NOT NULL, "topic_name" character varying NOT NULL, "query" character varying NOT NULL, "schema_key" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2315
+  (5.2ms) CREATE INDEX "index_nulogy_mb_producer_subscriptions_on_event_type" ON "message_bus_subscriptions" ("event_type")
2316
+  (6.4ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)
2317
+  (1.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2318
+  (2.1ms) INSERT INTO "schema_migrations" (version) VALUES (20201005164116)
2319
+  (2.1ms) INSERT INTO "schema_migrations" (version) VALUES
2320
+ (20200611150212),
2321
+ (20201005150212);
2322
+
2323
+ 
2324
+  (5.9ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2325
+ ActiveRecord::InternalMetadata Load (2.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2326
+  (0.8ms) BEGIN
2327
+ ActiveRecord::InternalMetadata Create (1.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2021-03-09 17:25:53.524890"], ["updated_at", "2021-03-09 17:25:53.524890"]]
2328
+  (1.5ms) COMMIT
2329
+ ActiveRecord::InternalMetadata Load (1.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2330
+  (1.0ms) BEGIN
2331
+ ActiveRecord::InternalMetadata Update (1.2ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2021-03-09 17:25:53.533488"], ["key", "environment"]]
2332
+  (1.6ms) COMMIT
2333
+  (1.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2334
+  (1.4ms) SELECT pg_try_advisory_lock(3053653019973222135)
2335
+  (5.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2336
+ Migrating to AddEventTypeToSubscriptionEvents (20210330204121)
2337
+  (2.0ms) BEGIN
2338
+  (8.7ms) ALTER TABLE "message_bus_subscriptions" ADD "event_type" text
2339
+  (2.0ms) ROLLBACK
2340
+  (2.1ms) SELECT pg_advisory_unlock(3053653019973222135)
2341
+  (1.9ms) CREATE DATABASE "nulogy_message_bus_producer_development" ENCODING = 'utf8'
2342
+  (1.8ms) CREATE DATABASE "nulogy_message_bus_producer_test" ENCODING = 'utf8'
2343
+  (1.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2344
+  (3.0ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2345
+  (1.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2346
+  (1.3ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2347
+  (1.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2348
+  (1.4ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2349
+ SQL (3.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
2350
+ SQL (1.6ms) CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
2351
+  (8.9ms) DROP TABLE IF EXISTS "message_bus_subscription_events" CASCADE
2352
+  (21.9ms) CREATE TABLE "message_bus_subscription_events" ("id" uuid NOT NULL PRIMARY KEY, "subscription_id" uuid NOT NULL, "partition_key" character varying NOT NULL, "topic_name" character varying NOT NULL, "company_uuid" uuid NOT NULL, "event_json" json NOT NULL, "created_at" timestamp)
2353
+  (4.3ms) CREATE INDEX "index_nulogy_mb_producer_subscription_events_on_created_at" ON "message_bus_subscription_events" ("created_at")
2354
+  (3.0ms) DROP TABLE IF EXISTS "message_bus_subscriptions" CASCADE
2355
+  (6.1ms) CREATE TABLE "message_bus_subscriptions" ("id" uuid NOT NULL PRIMARY KEY, "subscription_group_id" uuid NOT NULL, "event_type" character varying NOT NULL, "topic_name" character varying NOT NULL, "query" character varying NOT NULL, "schema_key" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2356
+  (3.6ms) CREATE INDEX "index_nulogy_mb_producer_subscriptions_on_event_type" ON "message_bus_subscriptions" ("event_type")
2357
+  (2.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2358
+ ActiveRecord::InternalMetadata Load (1.5ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2359
+  (1.5ms) BEGIN
2360
+  (1.6ms) COMMIT
2361
+ ActiveRecord::InternalMetadata Load (1.5ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2362
+  (1.7ms) BEGIN
2363
+  (1.4ms) COMMIT
2364
+ SQL (4.3ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
2365
+ SQL (2.1ms) CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
2366
+  (16.8ms) DROP TABLE IF EXISTS "message_bus_subscription_events" CASCADE
2367
+  (22.6ms) CREATE TABLE "message_bus_subscription_events" ("id" uuid NOT NULL PRIMARY KEY, "subscription_id" uuid NOT NULL, "partition_key" character varying NOT NULL, "topic_name" character varying NOT NULL, "company_uuid" uuid NOT NULL, "event_json" json NOT NULL, "created_at" timestamp)
2368
+  (4.5ms) CREATE INDEX "index_nulogy_mb_producer_subscription_events_on_created_at" ON "message_bus_subscription_events" ("created_at")
2369
+  (4.2ms) DROP TABLE IF EXISTS "message_bus_subscriptions" CASCADE
2370
+  (8.6ms) CREATE TABLE "message_bus_subscriptions" ("id" uuid NOT NULL PRIMARY KEY, "subscription_group_id" uuid NOT NULL, "event_type" character varying NOT NULL, "topic_name" character varying NOT NULL, "query" character varying NOT NULL, "schema_key" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2371
+  (4.1ms) CREATE INDEX "index_nulogy_mb_producer_subscriptions_on_event_type" ON "message_bus_subscriptions" ("event_type")
2372
+  (3.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2373
+  (5.9ms) INSERT INTO "schema_migrations" (version) VALUES (20201005164116)
2374
+  (3.0ms) INSERT INTO "schema_migrations" (version) VALUES
2375
+ (20200611150212),
2376
+ (20201005150212);
2377
+
2378
+ 
2379
+ ActiveRecord::InternalMetadata Load (3.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2380
+  (2.0ms) BEGIN
2381
+ ActiveRecord::InternalMetadata Create (3.6ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2021-03-30 20:52:23.588828"], ["updated_at", "2021-03-30 20:52:23.588828"]]
2382
+  (3.0ms) COMMIT
2383
+ ActiveRecord::InternalMetadata Load (2.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2384
+  (1.5ms) BEGIN
2385
+ ActiveRecord::InternalMetadata Update (1.8ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2021-03-30 20:52:23.604948"], ["key", "environment"]]
2386
+  (2.3ms) COMMIT
2387
+  (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2388
+  (1.1ms) SELECT pg_try_advisory_lock(3053653019973222135)
2389
+  (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2390
+ Migrating to AddEventTypeToSubscriptionEvents (20210330204121)
2391
+  (1.5ms) BEGIN
2392
+  (2.8ms) ALTER TABLE "message_bus_subscriptions" ADD "event_type" text
2393
+  (1.6ms) ROLLBACK
2394
+  (1.6ms) SELECT pg_advisory_unlock(3053653019973222135)
2395
+  (1.5ms) SELECT pg_try_advisory_lock(3053653019973222135)
2396
+  (2.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2397
+ Migrating to AddEventTypeToSubscriptionEvents (20210330204121)
2398
+  (1.6ms) BEGIN
2399
+  (3.1ms) ALTER TABLE "message_bus_subscriptions" ADD "event_type" text
2400
+  (1.6ms) ROLLBACK
2401
+  (2.4ms) SELECT pg_advisory_unlock(3053653019973222135)
2402
+  (2.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2403
+  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2404
+  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2405
+  (1.2ms) SELECT pg_try_advisory_lock(3053653019973222135)
2406
+  (1.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2407
+ Migrating to CreateActiveStorageTables (20201005164116)
2408
+  (1.2ms) BEGIN
2409
+ ActiveRecord::SchemaMigration Destroy (2.7ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = $1 [["version", "20201005164116"]]
2410
+  (5.3ms) COMMIT
2411
+  (1.4ms) SELECT pg_advisory_unlock(3053653019973222135)
2412
+  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2413
+  (1.1ms) SELECT pg_try_advisory_lock(3053653019973222135)
2414
+  (2.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2415
+ Migrating to CreateActiveStorageTables (20201005164116)
2416
+  (1.5ms) BEGIN
2417
+ ActiveRecord::SchemaMigration Create (1.7ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20201005164116"]]
2418
+  (2.7ms) COMMIT
2419
+ Migrating to AddEventTypeToSubscriptionEvents (20210330204121)
2420
+  (1.7ms) BEGIN
2421
+  (3.3ms) ALTER TABLE "message_bus_subscriptions" ADD "event_type" text
2422
+  (1.5ms) ROLLBACK
2423
+  (1.5ms) SELECT pg_advisory_unlock(3053653019973222135)
2424
+  (2.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2425
+  (1.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2426
+  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2427
+  (1.4ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2428
+  (1.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2429
+  (1.4ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2430
+  (24.4ms) DROP DATABASE IF EXISTS "nulogy_message_bus_producer_development"
2431
+  (1.8ms) DROP DATABASE IF EXISTS "nulogy_message_bus_producer_test"
2432
+  (248.6ms) CREATE DATABASE "nulogy_message_bus_producer_development" ENCODING = 'utf8'
2433
+  (1.9ms) CREATE DATABASE "nulogy_message_bus_producer_test" ENCODING = 'utf8'
2434
+  (16.4ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)
2435
+  (10.8ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2436
+  (1.3ms) SELECT pg_try_advisory_lock(3053653019973222135)
2437
+  (1.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2438
+ Migrating to CreatePublicSubscriptionsAndEventsTables (20200611150212)
2439
+  (1.5ms) BEGIN
2440
+ SQL (7.7ms) CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
2441
+  (6.6ms) CREATE TABLE "message_bus_subscriptions" ("id" uuid NOT NULL PRIMARY KEY, "subscription_group_id" uuid NOT NULL, "event_type" character varying NOT NULL, "topic_name" character varying NOT NULL, "query" character varying NOT NULL, "schema_key" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2442
+  (3.3ms) CREATE INDEX "index_nulogy_mb_producer_subscriptions_on_event_type" ON "message_bus_subscriptions" ("event_type")
2443
+  (5.9ms) CREATE TABLE "message_bus_subscription_events" ("id" uuid NOT NULL PRIMARY KEY, "public_subscription_id" uuid NOT NULL, "partition_key" character varying NOT NULL, "topic_name" character varying NOT NULL, "tenant_id" uuid NOT NULL, "event_json" json NOT NULL, "created_at" timestamp)
2444
+  (3.2ms) CREATE INDEX "index_nulogy_mb_producer_subscription_events_on_created_at" ON "message_bus_subscription_events" ("created_at")
2445
+ ActiveRecord::SchemaMigration Create (2.0ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20200611150212"]]
2446
+  (2.9ms) COMMIT
2447
+ Migrating to RenameTenantIdAndPublic (20201005150212)
2448
+  (1.2ms) BEGIN
2449
+  (2.3ms) ALTER TABLE "message_bus_subscription_events" RENAME COLUMN "tenant_id" TO "company_uuid"
2450
+  (1.5ms) ALTER TABLE "message_bus_subscription_events" RENAME COLUMN "public_subscription_id" TO "subscription_id"
2451
+ ActiveRecord::SchemaMigration Create (1.4ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20201005150212"]]
2452
+  (1.8ms) COMMIT
2453
+ Migrating to CreateActiveStorageTables (20201005164116)
2454
+  (1.4ms) BEGIN
2455
+ ActiveRecord::SchemaMigration Create (1.4ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20201005164116"]]
2456
+  (1.8ms) COMMIT
2457
+ Migrating to AddEventTypeToSubscriptionEvents (20210330204121)
2458
+  (1.9ms) BEGIN
2459
+  (2.2ms) ALTER TABLE "message_bus_subscriptions" ADD "event_type" text
2460
+  (1.3ms) ROLLBACK
2461
+  (1.6ms) SELECT pg_advisory_unlock(3053653019973222135)
2462
+  (1.4ms) SELECT pg_try_advisory_lock(3053653019973222135)
2463
+  (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2464
+ Migrating to AddEventTypeToSubscriptionEvents (20210330204121)
2465
+  (1.7ms) BEGIN
2466
+  (2.3ms) ALTER TABLE "message_bus_subscription_events" ADD "event_type" text
2467
+ ActiveRecord::SchemaMigration Create (2.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20210330204121"]]
2468
+  (2.3ms) COMMIT
2469
+ ActiveRecord::InternalMetadata Load (2.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2470
+  (1.5ms) BEGIN
2471
+ ActiveRecord::InternalMetadata Create (2.8ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2021-03-31 14:32:42.969683"], ["updated_at", "2021-03-31 14:32:42.969683"]]
2472
+  (1.8ms) COMMIT
2473
+  (1.2ms) SELECT pg_advisory_unlock(3053653019973222135)
2474
+  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2475
+  (4.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2476
+  (4.2ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2477
+  (1.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2478
+  (1.3ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2479
+  (1.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2480
+  (1.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2481
+  (3.0ms) DROP DATABASE IF EXISTS "nulogy_message_bus_producer_test"
2482
+  (2.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2483
+  (1.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2484
+  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2485
+  (1.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2486
+  (1.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2487
+  (1.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2488
+  (1.9ms) DROP DATABASE IF EXISTS "nulogy_message_bus_producer_test"
2489
+  (5.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2490
+  (4.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2491
+  (1.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2492
+  (1.4ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2493
+  (1.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2494
+  (1.2ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2495
+  (3.0ms) DROP DATABASE IF EXISTS "nulogy_message_bus_producer_test"
2496
+  (4.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2497
+  (2.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2498
+  (1.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2499
+  (1.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2500
+  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2501
+  (2.2ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2502
+  (23.2ms) DROP DATABASE IF EXISTS "nulogy_message_bus_producer_test"
2503
+  (223.2ms) CREATE DATABASE "nulogy_message_bus_producer_test" ENCODING = 'utf8'
2504
+ SQL (1.4ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
2505
+ SQL (7.9ms) CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
2506
+  (1.6ms) DROP TABLE IF EXISTS "message_bus_subscription_events" CASCADE
2507
+  (8.8ms) CREATE TABLE "message_bus_subscription_events" ("id" uuid NOT NULL PRIMARY KEY, "subscription_id" uuid NOT NULL, "partition_key" character varying NOT NULL, "topic_name" character varying NOT NULL, "company_uuid" uuid NOT NULL, "event_json" json NOT NULL, "created_at" timestamp, "event_type" text)
2508
+  (3.8ms) CREATE INDEX "index_nulogy_mb_producer_subscription_events_on_created_at" ON "message_bus_subscription_events" ("created_at")
2509
+  (1.4ms) DROP TABLE IF EXISTS "message_bus_subscriptions" CASCADE
2510
+  (5.9ms) CREATE TABLE "message_bus_subscriptions" ("id" uuid NOT NULL PRIMARY KEY, "subscription_group_id" uuid NOT NULL, "event_type" character varying NOT NULL, "topic_name" character varying NOT NULL, "query" character varying NOT NULL, "schema_key" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2511
+  (3.8ms) CREATE INDEX "index_nulogy_mb_producer_subscriptions_on_event_type" ON "message_bus_subscriptions" ("event_type")
2512
+  (6.2ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)
2513
+  (1.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2514
+  (1.9ms) INSERT INTO "schema_migrations" (version) VALUES (20210330204121)
2515
+  (2.2ms) INSERT INTO "schema_migrations" (version) VALUES
2516
+ (20201005164116),
2517
+ (20200611150212),
2518
+ (20201005150212);
2519
+
2520
+ 
2521
+  (6.0ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2522
+ ActiveRecord::InternalMetadata Load (2.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2523
+  (1.4ms) BEGIN
2524
+ ActiveRecord::InternalMetadata Create (1.6ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2021-03-31 17:26:56.186267"], ["updated_at", "2021-03-31 17:26:56.186267"]]
2525
+  (1.8ms) COMMIT
2526
+ ActiveRecord::InternalMetadata Load (1.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2527
+  (1.3ms) BEGIN
2528
+ ActiveRecord::InternalMetadata Update (1.5ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2021-03-31 17:26:56.197348"], ["key", "environment"]]
2529
+  (1.7ms) COMMIT
2530
+ NulogyMessageBusProducer::SubscriptionEvent Load (3.6ms) SELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2 [["id", "052ccd7d-fcb8-4779-a431-edcd07c6f9f2"], ["LIMIT", 1]]
2531
+  (1.5ms) BEGIN
2532
+ NulogyMessageBusProducer::SubscriptionEvent Create (2.1ms) INSERT INTO "message_bus_subscription_events" ("id", "subscription_id", "partition_key", "topic_name", "company_uuid", "event_json", "created_at", "event_type") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["id", "052ccd7d-fcb8-4779-a431-edcd07c6f9f2"], ["subscription_id", "b7431c4b-6ba1-48de-9089-0d551a0b2289"], ["partition_key", "d42fd0ff-5f7c-4479-a555-275ad4a3d9ba"], ["topic_name", "some-topic"], ["company_uuid", "d42fd0ff-5f7c-4479-a555-275ad4a3d9ba"], ["event_json", "{\"field\":\"value\"}"], ["created_at", "2021-03-31 18:13:57.002078"], ["event_type", "some-type"]]
2533
+  (2.9ms) COMMIT
2534
+ NulogyMessageBusProducer::SubscriptionEvent Load (2.9ms) SELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2 [["id", "4301a9a9-410d-4906-a308-3f2e2a716481"], ["LIMIT", 1]]
2535
+  (1.9ms) BEGIN
2536
+ NulogyMessageBusProducer::SubscriptionEvent Create (1.9ms) INSERT INTO "message_bus_subscription_events" ("id", "subscription_id", "partition_key", "topic_name", "company_uuid", "event_json", "created_at", "event_type") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["id", "4301a9a9-410d-4906-a308-3f2e2a716481"], ["subscription_id", "af99e3c4-e8da-4650-8429-a093d57e28c5"], ["partition_key", "43c04d27-3b88-4bb8-aa32-6e9cc401a9a1"], ["topic_name", "some-topic"], ["company_uuid", "43c04d27-3b88-4bb8-aa32-6e9cc401a9a1"], ["event_json", "{\"field\":\"value\"}"], ["created_at", "2021-03-31 18:20:17.588245"], ["event_type", "some-type"]]
2537
+  (2.9ms) COMMIT
2538
+ NulogyMessageBusProducer::SubscriptionEvent Load (2.4ms) SELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2 [["id", "0de39387-eb7b-4c82-981e-5440bcb563b0"], ["LIMIT", 1]]
2539
+  (1.7ms) BEGIN
2540
+ NulogyMessageBusProducer::SubscriptionEvent Create (2.1ms) INSERT INTO "message_bus_subscription_events" ("id", "subscription_id", "partition_key", "topic_name", "company_uuid", "event_json", "created_at", "event_type") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["id", "0de39387-eb7b-4c82-981e-5440bcb563b0"], ["subscription_id", "9d1b70b1-7598-4687-a634-d55b17f868cc"], ["partition_key", "c7075533-fd2e-4f63-b964-980f3fa5f4a6"], ["topic_name", "some-topic"], ["company_uuid", "c7075533-fd2e-4f63-b964-980f3fa5f4a6"], ["event_json", "{\"field\":\"value\"}"], ["created_at", "2021-03-31 18:21:19.585687"], ["event_type", "some-type"]]
2541
+  (2.9ms) COMMIT
2542
+ NulogyMessageBusProducer::SubscriptionEvent Load (2.6ms) SELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2 [["id", "afa71c73-ea8c-4c05-ab56-5518923ef09f"], ["LIMIT", 1]]
2543
+  (1.6ms) BEGIN
2544
+ NulogyMessageBusProducer::SubscriptionEvent Create (2.1ms) INSERT INTO "message_bus_subscription_events" ("id", "subscription_id", "partition_key", "topic_name", "company_uuid", "event_json", "created_at", "event_type") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["id", "afa71c73-ea8c-4c05-ab56-5518923ef09f"], ["subscription_id", "a91d295d-d570-49fc-bb50-7bc2317e7635"], ["partition_key", "106bea13-ccdb-49a5-a613-9c3e206267ca"], ["topic_name", "some-topic"], ["company_uuid", "106bea13-ccdb-49a5-a613-9c3e206267ca"], ["event_json", "{\"field\":\"value\"}"], ["created_at", "2021-03-31 18:21:20.593447"], ["event_type", "some-type"]]
2545
+  (3.1ms) COMMIT
2546
+ NulogyMessageBusProducer::SubscriptionEvent Load (2.3ms) SELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2 [["id", "91cc1302-d68e-42e4-8491-d4743289c54a"], ["LIMIT", 1]]
2547
+  (1.7ms) BEGIN
2548
+ NulogyMessageBusProducer::SubscriptionEvent Create (1.9ms) INSERT INTO "message_bus_subscription_events" ("id", "subscription_id", "partition_key", "topic_name", "company_uuid", "event_json", "created_at", "event_type") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["id", "91cc1302-d68e-42e4-8491-d4743289c54a"], ["subscription_id", "d820eb79-29b4-48cb-91d3-aa6deeb7b182"], ["partition_key", "67afaf53-d2b3-47cd-937b-6d4ef9492b39"], ["topic_name", "some-topic"], ["company_uuid", "67afaf53-d2b3-47cd-937b-6d4ef9492b39"], ["event_json", "{\"field\":\"value\"}"], ["created_at", "2021-03-31 18:21:21.425429"], ["event_type", "some-type"]]
2549
+  (3.0ms) COMMIT
2550
+ NulogyMessageBusProducer::SubscriptionEvent Load (2.2ms) SELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2 [["id", "31e9b591-c646-4fcc-bcc6-70afe4aaa05c"], ["LIMIT", 1]]
2551
+  (1.3ms) BEGIN
2552
+ NulogyMessageBusProducer::SubscriptionEvent Create (1.3ms) INSERT INTO "message_bus_subscription_events" ("id", "subscription_id", "partition_key", "topic_name", "company_uuid", "event_json", "created_at", "event_type") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["id", "31e9b591-c646-4fcc-bcc6-70afe4aaa05c"], ["subscription_id", "8e8b156e-b4e5-47a7-9f86-e6e876ccaf51"], ["partition_key", "c035daf9-1d15-4515-bbe2-7170a1ed7402"], ["topic_name", "some-topic"], ["company_uuid", "c035daf9-1d15-4515-bbe2-7170a1ed7402"], ["event_json", "{\"field\":\"value\"}"], ["created_at", "2021-03-31 18:21:22.409136"], ["event_type", "some-type"]]
2553
+  (1.8ms) COMMIT