bookingsync-engine 5.1.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '04970c8c4ded9348198bd16ea6e3ca052213dc693aeaf6825f2137e854491148'
4
- data.tar.gz: 3a64320db5785bfb08052e1c6202292c52a527d5ab6dc02ee5241a7e842f0299
3
+ metadata.gz: 76d677891a37b6bf242cc2ecdccac253d00e74d980c4c674f1e4e258a23c27aa
4
+ data.tar.gz: 6bbe344b51c76817b5f91e5db0196a8ff651a8ed668c15e8c24f809357fe7568
5
5
  SHA512:
6
- metadata.gz: 91fcdf1bc5c1c34b8c6fa48c28334c629ba38ad5a724de5130b64363b7b84869cc55a05fc7a1a5a76eb7a06c03b392c4432b92f821cabf9720a3a19b685a2508
7
- data.tar.gz: fc63d79559a6f768ae390987e3fad8d554510b5eecf0ee5a3cb7f16768741564d5ee4a701ef5cb9478da55737d2301cf332665ad9845aa00de91c6de3c7aaff2
6
+ metadata.gz: 0105eb59ada39b9121ad1aad63e72f7c8f9d1d717ef9cfa85ad5189b9aedf06aa61bc165265289ca55e783546ce2713f720fe26d900116b3cbe5f9d84a921587
7
+ data.tar.gz: 850bbffb9e6233f2c15009073a463ecfed670bb46db08a5b62afd5abdd8dcb5df0eee57f580872a1603cc84f897dcd4997d2d7e09c8361b384d63a2535b54640
@@ -2,4 +2,6 @@
2
2
 
3
3
  <p>Error: <%= @error_message %></p>
4
4
 
5
- <a href="/auth/bookingsync">Sign in again</a>
5
+ <%= form_tag("/auth/bookingsync", method: :post) do %>
6
+ <button type="submit">Sign in again</button>
7
+ <% end %>
@@ -14,6 +14,9 @@ module BookingSyncEngine
14
14
  cattr_accessor :token_refresh_timeout_retry_count
15
15
  self.token_refresh_timeout_retry_count = 2
16
16
 
17
+ cattr_accessor :bookingsync_id_key
18
+ self.bookingsync_id_key = :synced_id
19
+
17
20
  def self.setup
18
21
  yield self
19
22
  end
@@ -1,3 +1,5 @@
1
+ require "repost"
2
+
1
3
  module BookingSync::Engine::AuthHelpers
2
4
  extend ActiveSupport::Concern
3
5
 
@@ -16,7 +18,7 @@ module BookingSync::Engine::AuthHelpers
16
18
  return if session[:account_id].nil?
17
19
 
18
20
  @current_account ||=
19
- ::BookingSyncEngine.account_model.find_by_host_and_synced_id(request.host, session[:account_id])
21
+ ::BookingSyncEngine.account_model.find_by_host_and_bookingsync_id_key(request.host, session[:account_id])
20
22
  end
21
23
 
22
24
  # Callback after account is authorized.
@@ -25,7 +27,7 @@ module BookingSync::Engine::AuthHelpers
25
27
  #
26
28
  # @param account [Account] the just authorized account
27
29
  def account_authorized(account)
28
- session[:account_id] = account.synced_id.to_s
30
+ session[:account_id] = account.public_send(BookingSyncEngine.bookingsync_id_key).to_s
29
31
  end
30
32
 
31
33
  # Clear authorization if the account passed from the BookingSync app store
@@ -58,20 +60,32 @@ module BookingSync::Engine::AuthHelpers
58
60
 
59
61
  # Request a new authorization.
60
62
  def request_authorization!
61
- if request.xhr?
62
- request_authorization_for_xhr!
63
- elsif BookingSync::Engine.embedded
64
- request_authorization_for_embedded!
65
- else
66
- request_authorization_for_standalone!
63
+ respond_to do |format|
64
+ format.html do
65
+ if request.xhr?
66
+ request_authorization_for_xhr!
67
+ elsif BookingSync::Engine.embedded
68
+ request_authorization_for_embedded!
69
+ else
70
+ request_authorization_for_standalone!
71
+ end
72
+ end
73
+
74
+ format.json do
75
+ head :unauthorized
76
+ end
77
+
78
+ format.api_json do
79
+ head :unauthorized
80
+ end
67
81
  end
68
82
  end
69
83
 
70
84
  # Request a new authorization for Ajax requests.
71
85
  #
72
- # Renders the new authorization path with 401 Unauthorized status by default.
86
+ # Renders the new auto submit form with 401 Unauthorized status by default.
73
87
  def request_authorization_for_xhr!
74
- render plain: new_authorization_url, status: :unauthorized
88
+ render html: auto_submit_form_html, status: :unauthorized
75
89
  end
76
90
 
77
91
  # Request a new authorization for Embedded Apps.
@@ -79,23 +93,23 @@ module BookingSync::Engine::AuthHelpers
79
93
  # Load the new authorization path using Javascript by default.
80
94
  def request_authorization_for_embedded!
81
95
  allow_bookingsync_iframe
82
- render html: ("<script type='text/javascript'>top.location.href = " +
83
- "'#{new_authorization_path}';</script>").html_safe
96
+ render html: auto_submit_form_html
84
97
  end
85
98
 
86
99
  # Request a new authorization for Standalone Apps.
87
100
  #
88
101
  # Redirects to new authorization path by default.
89
102
  def request_authorization_for_standalone!
90
- redirect_to new_authorization_path
103
+ render html: auto_submit_form_html
91
104
  end
92
105
 
93
- # Path to which the user should be redirected to start a new
106
+ # Path which will be used in POST request to start a new
94
107
  # Authorization process.
95
108
  #
96
- # Default to /auth/bookingsync/?account_id=SESSION_BOOKINGSYNC_ACCOUNT_ID
109
+ # Default to /auth/bookingsync
110
+ NEW_AUTHORIZATION_URL = "/auth/bookingsync".freeze
97
111
  def new_authorization_path
98
- "/auth/bookingsync/?account_id=#{session[:_bookingsync_account_id]}"
112
+ NEW_AUTHORIZATION_URL
99
113
  end
100
114
 
101
115
  def new_authorization_url
@@ -141,4 +155,12 @@ module BookingSync::Engine::AuthHelpers
141
155
  def store_bookingsync_account_id # :nodoc:
142
156
  session[:_bookingsync_account_id] = params.delete(:_bookingsync_account_id)
143
157
  end
158
+
159
+ def auto_submit_form_html
160
+ Repost::Senpai.perform(
161
+ new_authorization_path,
162
+ params: { account_id: session[:_bookingsync_account_id] },
163
+ options: { authenticity_token: Rack::Protection::AuthenticityToken.token(session) }
164
+ ).html_safe
165
+ end
144
166
  end
@@ -3,12 +3,12 @@ module BookingSync::Engine::Models::Account
3
3
  include BookingSync::Engine::Models::BaseAccount
4
4
 
5
5
  included do
6
- validates :synced_id, uniqueness: true
6
+ validates BookingSyncEngine.bookingsync_id_key, uniqueness: true
7
7
  end
8
8
 
9
9
  module ClassMethods
10
10
  def from_omniauth(auth, _host)
11
- account = find_or_initialize_by(synced_id: auth.uid, provider: auth.provider)
11
+ account = find_or_initialize_by(BookingSyncEngine.bookingsync_id_key => auth.uid, provider: auth.provider)
12
12
 
13
13
  account.tap do |account|
14
14
  account.name = auth.info.business_name
@@ -17,8 +17,14 @@ module BookingSync::Engine::Models::Account
17
17
  end
18
18
  end
19
19
 
20
+ def find_by_host_and_bookingsync_id_key(_host, bookingsync_id)
21
+ find_by(BookingSyncEngine.bookingsync_id_key => bookingsync_id)
22
+ end
23
+
24
+ # DEPRECATED: Please use find_by_host_and_bookingsync_id_key instead.
20
25
  def find_by_host_and_synced_id(_host, synced_id)
21
- find_by(synced_id: synced_id)
26
+ warn("DEPRECATED: find_by_host_and_synced_id is deprecated, use #find_by_host_and_bookingsync_id_key instead. It will be removed with the release of version 6 of this gem. Called from #{Gem.location_of_caller.join(":")}")
27
+ find_by_host_and_bookingsync_id_key(nil, synced_id)
22
28
  end
23
29
  end
24
30
 
@@ -3,7 +3,7 @@ module BookingSync::Engine::Models::MultiApplicationsAccount
3
3
  include BookingSync::Engine::Models::BaseAccount
4
4
 
5
5
  included do
6
- validates :synced_id, uniqueness: { scope: :host }
6
+ validates BookingSyncEngine.bookingsync_id_key, uniqueness: { scope: :host }
7
7
  end
8
8
 
9
9
  module ClassMethods
@@ -13,7 +13,7 @@ module BookingSync::Engine::Models::MultiApplicationsAccount
13
13
  "multi application support"
14
14
  end
15
15
 
16
- account = find_or_initialize_by(host: host, synced_id: auth.uid, provider: auth.provider)
16
+ account = find_or_initialize_by(host: host, provider: auth.provider, BookingSyncEngine.bookingsync_id_key => auth.uid)
17
17
 
18
18
  account.tap do |account|
19
19
  account.name = auth.info.business_name
@@ -22,8 +22,14 @@ module BookingSync::Engine::Models::MultiApplicationsAccount
22
22
  end
23
23
  end
24
24
 
25
+ def find_by_host_and_bookingsync_id_key(host, bookingsync_id)
26
+ find_by(host: host, BookingSyncEngine.bookingsync_id_key => bookingsync_id)
27
+ end
28
+
29
+ # DEPRECATED: Please use find_by_host_and_bookingsync_id_key instead.
25
30
  def find_by_host_and_synced_id(host, synced_id)
26
- find_by(host: host, synced_id: synced_id)
31
+ warn("DEPRECATED: find_by_host_and_synced_id is deprecated, use #find_by_host_and_bookingsync_id_key instead. It will be removed with the release of version 5 of this gem. Called from #{Gem.location_of_caller.join(":")}")
32
+ find_by_host_and_bookingsync_id_key(host, synced_id)
27
33
  end
28
34
  end
29
35
 
@@ -1,3 +1,3 @@
1
1
  module BookingSync
2
- ENGINE_VERSION = "5.1.0"
2
+ ENGINE_VERSION = "6.0.0"
3
3
  end
@@ -1,15 +1,19 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe AuthenticatedController, type: :controller do
4
+ before do
5
+ Mime::Type.register "application/vnd.api+json", :api_json
6
+ end
7
+
4
8
  describe "GET index" do
5
9
  context "when engine is embedded" do
6
10
  before { BookingSync::Engine.embedded! }
7
11
 
8
- it "redirects to auth using js" do
12
+ it "renders autosubmitted form" do
9
13
  get :index
10
14
  expect(response.status).to eq(200)
11
- expect(response.body).to eq(
12
- "<script type='text/javascript'>top.location.href = '/auth/bookingsync/?account_id=';</script>")
15
+ expect(response.body).to include("action='/auth/bookingsync' method='post'")
16
+ expect(response.body).to include("<input type='hidden' name='account_id' value=''>")
13
17
  expect(response.header["Content-Type"]).to include("text/html")
14
18
  end
15
19
  end
@@ -17,12 +21,11 @@ RSpec.describe AuthenticatedController, type: :controller do
17
21
  context "when engine is standalone" do
18
22
  before { BookingSync::Engine.standalone! }
19
23
 
20
- it "redirects to auth using 302 redirect" do
24
+ it "renders autosubmitted form" do
21
25
  get :index
22
- expect(response.status).to eq(302)
23
- expect(response.redirect_url).to eq("http://test.host/auth/bookingsync/?account_id=")
24
- expect(response.body).to eq(
25
- "<html><body>You are being <a href=\"http://test.host/auth/bookingsync/?account_id=\">redirected</a>.</body></html>")
26
+ expect(response.status).to eq(200)
27
+ expect(response.body).to include("action='/auth/bookingsync' method='post'")
28
+ expect(response.body).to include("<input type='hidden' name='account_id' value=''>")
26
29
  end
27
30
  end
28
31
  end
@@ -31,20 +34,41 @@ RSpec.describe AuthenticatedController, type: :controller do
31
34
  context "when engine is embedded" do
32
35
  before { BookingSync::Engine.embedded! }
33
36
 
34
- it "renders the target url in response" do
37
+ it "renders autosubmitted form" do
35
38
  get :index, xhr: true
36
39
  expect(response.status).to eq(401)
37
- expect(response.body).to eq("http://test.host/auth/bookingsync/?account_id=")
40
+ expect(response.body).to include("action='/auth/bookingsync' method='post'")
41
+ expect(response.body).to include("<input type='hidden' name='account_id' value=''>")
38
42
  end
39
43
  end
40
44
 
41
45
  context "when engine is standalone" do
42
46
  before { BookingSync::Engine.standalone! }
43
47
 
44
- it "renders the target url in response" do
48
+ it "renders autosubmitted form" do
45
49
  get :index, xhr: true
46
50
  expect(response.status).to eq(401)
47
- expect(response.body).to eq("http://test.host/auth/bookingsync/?account_id=")
51
+ expect(response.body).to include("action='/auth/bookingsync' method='post'")
52
+ expect(response.body).to include("<input type='hidden' name='account_id' value=''>")
53
+ end
54
+ end
55
+ end
56
+
57
+ describe "API request" do
58
+ it "returns 401 without response body" do
59
+ get :index, format: :json
60
+ expect(response.status).to eq(401)
61
+ expect(response.body).to eq("")
62
+ end
63
+
64
+ context "with vnd.api+json content type" do
65
+ it "returns 401 without response body" do
66
+ request.headers["CONTENT_TYPE"] = "application/vnd.api+json"
67
+ request.headers["ACCEPT"] = "application/vnd.api+json"
68
+
69
+ get :index
70
+ expect(response.status).to eq(401)
71
+ expect(response.body).to eq("")
48
72
  end
49
73
  end
50
74
  end
@@ -1,3 +1,11 @@
1
+ # temporarily change default to make sure initializer override works great
2
+ BookingSyncEngine.module_eval do
3
+ self.bookingsync_id_key = :customized_key
4
+ end
5
+
6
+ # and now override to fix breaking specs
1
7
  BookingSyncEngine.setup do |setup|
2
8
  setup.multi_app_model = -> { ::MultiApplicationsAccount }
9
+
10
+ setup.bookingsync_id_key = :synced_id
3
11
  end
@@ -0,0 +1,5 @@
1
+ class AddCustomBookingSyncKeyIdToAccounts < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :accounts, :customized_key, :integer
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddCustomBookingSyncKeyIdToMultiApplicationsAccounts < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :multi_applications_accounts, :customized_key, :integer
4
+ end
5
+ end
@@ -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: 2018_11_30_063104) do
13
+ ActiveRecord::Schema.define(version: 2019_06_23_220132) do
14
14
 
15
15
  # These are extensions that must be enabled in order to support this database
16
16
  enable_extension "plpgsql"
@@ -24,6 +24,7 @@ ActiveRecord::Schema.define(version: 2018_11_30_063104) do
24
24
  t.string "oauth_access_token"
25
25
  t.string "oauth_refresh_token"
26
26
  t.string "oauth_expires_at"
27
+ t.integer "customized_key"
27
28
  t.index ["synced_id"], name: "index_accounts_on_synced_id"
28
29
  end
29
30
 
@@ -48,6 +49,7 @@ ActiveRecord::Schema.define(version: 2018_11_30_063104) do
48
49
  t.string "oauth_refresh_token"
49
50
  t.string "oauth_expires_at"
50
51
  t.string "host", null: false
52
+ t.integer "customized_key"
51
53
  t.index ["host", "synced_id"], name: "index_multi_applications_accounts_on_host_and_synced_id", unique: true
52
54
  t.index ["host"], name: "index_multi_applications_accounts_on_host"
53
55
  t.index ["synced_id"], name: "index_multi_applications_accounts_on_synced_id"
@@ -1,263 +1,2 @@
1
-  (405.2ms) CREATE DATABASE "bookingsync_engine_development" ENCODING = 'unicode'
2
-  (293.1ms) CREATE DATABASE "bookingsync_engine_test" ENCODING = 'unicode'
3
-  (13.4ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)
4
-  (3.1ms) 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)
5
-  (0.4ms) SELECT pg_try_advisory_lock(4021716121895623095)
6
-  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
7
- Migrating to CreateAccounts (20140522110326)
8
-  (0.1ms) BEGIN
9
-  (5.4ms) CREATE TABLE "accounts" ("id" bigserial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
10
- ActiveRecord::SchemaMigration Create (0.5ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20140522110326"]]
11
-  (0.7ms) COMMIT
12
- Migrating to AddOAuthFieldsToAccounts (20140522110454)
13
-  (0.3ms) BEGIN
14
-  (2.5ms) ALTER TABLE "accounts" ADD "provider" character varying
15
-  (0.3ms) ALTER TABLE "accounts" ADD "synced_id" integer
16
-  (1.4ms) CREATE INDEX "index_accounts_on_synced_id" ON "accounts" ("synced_id")
17
-  (0.2ms) ALTER TABLE "accounts" ADD "name" character varying
18
-  (0.2ms) ALTER TABLE "accounts" ADD "oauth_access_token" character varying
19
-  (0.4ms) ALTER TABLE "accounts" ADD "oauth_refresh_token" character varying
20
-  (0.2ms) ALTER TABLE "accounts" ADD "oauth_expires_at" character varying
21
- ActiveRecord::SchemaMigration Create (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20140522110454"]]
22
-  (0.4ms) COMMIT
23
- Migrating to CreateMultiApplicationsAccounts (20181130062531)
24
-  (0.1ms) BEGIN
25
-  (1.7ms) CREATE TABLE "multi_applications_accounts" ("id" bigserial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
26
- ActiveRecord::SchemaMigration Create (0.5ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20181130062531"]]
27
-  (0.4ms) COMMIT
28
- Migrating to AddOAuthFieldsToMultiApplicationsAccounts (20181130062650)
29
-  (0.2ms) BEGIN
30
-  (1.2ms) ALTER TABLE "multi_applications_accounts" ADD "provider" character varying
31
-  (0.2ms) ALTER TABLE "multi_applications_accounts" ADD "synced_id" integer
32
-  (1.1ms) CREATE INDEX "index_multi_applications_accounts_on_synced_id" ON "multi_applications_accounts" ("synced_id")
33
-  (0.3ms) ALTER TABLE "multi_applications_accounts" ADD "name" character varying
34
-  (0.2ms) ALTER TABLE "multi_applications_accounts" ADD "oauth_access_token" character varying
35
-  (0.2ms) ALTER TABLE "multi_applications_accounts" ADD "oauth_refresh_token" character varying
36
-  (0.2ms) ALTER TABLE "multi_applications_accounts" ADD "oauth_expires_at" character varying
37
-  (0.5ms) ALTER TABLE "multi_applications_accounts" ADD "host" character varying NOT NULL
38
-  (1.1ms) CREATE INDEX "index_multi_applications_accounts_on_host" ON "multi_applications_accounts" ("host")
39
-  (0.9ms) CREATE UNIQUE INDEX "index_multi_applications_accounts_on_host_and_synced_id" ON "multi_applications_accounts" ("host", "synced_id")
40
- ActiveRecord::SchemaMigration Create (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20181130062650"]]
41
-  (0.5ms) COMMIT
42
- Migrating to CreateApplications (20181130063056)
43
-  (0.2ms) BEGIN
44
-  (6.2ms) CREATE TABLE "applications" ("id" bigserial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
45
- ActiveRecord::SchemaMigration Create (0.8ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20181130063056"]]
46
-  (0.7ms) COMMIT
47
- Migrating to AddCredentialsFieldsToApplications (20181130063104)
48
-  (0.9ms) BEGIN
49
-  (5.1ms) ALTER TABLE "applications" ADD "host" character varying NOT NULL
50
-  (1.2ms) CREATE UNIQUE INDEX "index_applications_on_host" ON "applications" ("host")
51
-  (0.4ms) ALTER TABLE "applications" ADD "client_id" text NOT NULL
52
-  (1.4ms) CREATE UNIQUE INDEX "index_applications_on_client_id" ON "applications" ("client_id")
53
-  (0.3ms) ALTER TABLE "applications" ADD "client_secret" text NOT NULL
54
-  (6.0ms) CREATE UNIQUE INDEX "index_applications_on_client_secret" ON "applications" ("client_secret")
55
- ActiveRecord::SchemaMigration Create (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20181130063104"]]
56
-  (0.5ms) COMMIT
57
- ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
58
-  (0.2ms) BEGIN
59
- ActiveRecord::InternalMetadata Create (1.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2019-06-21 14:35:31.093625"], ["updated_at", "2019-06-21 14:35:31.093625"]]
60
-  (0.7ms) COMMIT
61
-  (0.3ms) SELECT pg_advisory_unlock(4021716121895623095)
62
-  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
63
-  (0.2ms) SELECT pg_try_advisory_lock(4021716121895623095)
64
-  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
65
- ActiveRecord::InternalMetadata Load (0.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
66
-  (0.2ms) BEGIN
67
-  (0.1ms) COMMIT
68
-  (0.2ms) SELECT pg_advisory_unlock(4021716121895623095)
69
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
70
-  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
71
-  (0.4ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
72
-  (0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
73
-  (0.2ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
74
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
75
-  (0.3ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
76
- SQL (3.4ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
77
-  (5.9ms) DROP TABLE IF EXISTS "accounts" CASCADE
78
-  (4.9ms) CREATE TABLE "accounts" ("id" bigserial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "provider" character varying, "synced_id" integer, "name" character varying, "oauth_access_token" character varying, "oauth_refresh_token" character varying, "oauth_expires_at" character varying)
79
-  (1.3ms) CREATE INDEX "index_accounts_on_synced_id" ON "accounts" ("synced_id")
80
-  (2.8ms) DROP TABLE IF EXISTS "applications" CASCADE
81
-  (4.6ms) CREATE TABLE "applications" ("id" bigserial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "host" character varying NOT NULL, "client_id" text NOT NULL, "client_secret" text NOT NULL)
82
-  (1.3ms) CREATE UNIQUE INDEX "index_applications_on_client_id" ON "applications" ("client_id")
83
-  (1.6ms) CREATE UNIQUE INDEX "index_applications_on_client_secret" ON "applications" ("client_secret")
84
-  (6.3ms) CREATE UNIQUE INDEX "index_applications_on_host" ON "applications" ("host")
85
-  (3.8ms) DROP TABLE IF EXISTS "multi_applications_accounts" CASCADE
86
-  (10.4ms) CREATE TABLE "multi_applications_accounts" ("id" bigserial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "provider" character varying, "synced_id" integer, "name" character varying, "oauth_access_token" character varying, "oauth_refresh_token" character varying, "oauth_expires_at" character varying, "host" character varying NOT NULL)
87
-  (4.1ms) CREATE UNIQUE INDEX "index_multi_applications_accounts_on_host_and_synced_id" ON "multi_applications_accounts" ("host", "synced_id")
88
-  (2.4ms) CREATE INDEX "index_multi_applications_accounts_on_host" ON "multi_applications_accounts" ("host")
89
-  (1.2ms) CREATE INDEX "index_multi_applications_accounts_on_synced_id" ON "multi_applications_accounts" ("synced_id")
90
-  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
91
- ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
92
-  (0.2ms) BEGIN
93
-  (0.1ms) COMMIT
94
- ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
95
-  (0.1ms) BEGIN
96
-  (0.1ms) COMMIT
97
- SQL (1.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
98
-  (0.2ms) DROP TABLE IF EXISTS "accounts" CASCADE
99
-  (40.9ms) CREATE TABLE "accounts" ("id" bigserial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "provider" character varying, "synced_id" integer, "name" character varying, "oauth_access_token" character varying, "oauth_refresh_token" character varying, "oauth_expires_at" character varying)
100
-  (1.7ms) CREATE INDEX "index_accounts_on_synced_id" ON "accounts" ("synced_id")
101
-  (0.2ms) DROP TABLE IF EXISTS "applications" CASCADE
102
-  (4.8ms) CREATE TABLE "applications" ("id" bigserial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "host" character varying NOT NULL, "client_id" text NOT NULL, "client_secret" text NOT NULL)
103
-  (1.3ms) CREATE UNIQUE INDEX "index_applications_on_client_id" ON "applications" ("client_id")
104
-  (1.9ms) CREATE UNIQUE INDEX "index_applications_on_client_secret" ON "applications" ("client_secret")
105
-  (7.1ms) CREATE UNIQUE INDEX "index_applications_on_host" ON "applications" ("host")
106
-  (0.2ms) DROP TABLE IF EXISTS "multi_applications_accounts" CASCADE
107
-  (4.9ms) CREATE TABLE "multi_applications_accounts" ("id" bigserial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "provider" character varying, "synced_id" integer, "name" character varying, "oauth_access_token" character varying, "oauth_refresh_token" character varying, "oauth_expires_at" character varying, "host" character varying NOT NULL)
108
-  (1.3ms) CREATE UNIQUE INDEX "index_multi_applications_accounts_on_host_and_synced_id" ON "multi_applications_accounts" ("host", "synced_id")
109
-  (1.2ms) CREATE INDEX "index_multi_applications_accounts_on_host" ON "multi_applications_accounts" ("host")
110
-  (7.6ms) CREATE INDEX "index_multi_applications_accounts_on_synced_id" ON "multi_applications_accounts" ("synced_id")
111
-  (8.0ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)
112
-  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
113
-  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES (20181130063104)
114
-  (0.5ms) INSERT INTO "schema_migrations" (version) VALUES
115
- (20140522110454),
116
- (20181130062650),
117
- (20181130063056),
118
- (20140522110326),
119
- (20181130062531);
120
-
121
- 
122
-  (3.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)
123
- ActiveRecord::InternalMetadata Load (0.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
124
-  (0.1ms) BEGIN
125
- ActiveRecord::InternalMetadata Create (0.5ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2019-06-21 14:40:15.884905"], ["updated_at", "2019-06-21 14:40:15.884905"]]
126
-  (0.4ms) COMMIT
127
- ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
128
-  (0.1ms) BEGIN
129
- ActiveRecord::InternalMetadata Update (0.5ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2019-06-21 14:40:15.889023"], ["key", "environment"]]
130
-  (0.4ms) COMMIT
131
-  (1.1ms) SELECT pg_try_advisory_lock(4021716121895623095)
132
-  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
133
- Migrating to AddCustomBookingSyncKeyIdToAccounts (20190623220013)
134
-  (0.6ms) BEGIN
135
-  (5.0ms) ALTER TABLE "accounts" ADD "customized_key" integer
136
- ActiveRecord::SchemaMigration Create (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20190623220013"]]
137
-  (0.6ms) COMMIT
138
- ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
139
-  (0.2ms) BEGIN
140
-  (0.2ms) COMMIT
141
-  (0.2ms) SELECT pg_advisory_unlock(4021716121895623095)
142
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
143
-  (0.3ms) SELECT pg_try_advisory_lock(4021716121895623095)
144
-  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
145
- Migrating to AddCustomBookingSyncKeyIdToMultiApplicationsAccounts (20190623220132)
146
-  (0.2ms) BEGIN
147
-  (0.6ms) ALTER TABLE "multi_applications_accounts" ADD "customized_key" integer
148
- ActiveRecord::SchemaMigration Create (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20190623220132"]]
149
-  (2.0ms) COMMIT
150
- ActiveRecord::InternalMetadata Load (0.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
151
-  (0.1ms) BEGIN
152
-  (0.2ms) COMMIT
153
-  (0.3ms) SELECT pg_advisory_unlock(4021716121895623095)
154
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
155
-  (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
156
-  (0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
157
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
158
-  (0.2ms) SELECT pg_try_advisory_lock(4021716121895623095)
159
-  (0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
160
- Migrating to AddCustomBookingSyncKeyIdToMultiApplicationsAccounts (20190623220132)
161
-  (0.2ms) BEGIN
162
-  (3.1ms) ALTER TABLE "multi_applications_accounts" DROP COLUMN "customized_key"
163
- ActiveRecord::SchemaMigration Destroy (0.5ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = $1 [["version", "20190623220132"]]
164
-  (0.6ms) COMMIT
165
- Migrating to AddCustomBookingSyncKeyIdToAccounts (20190623220013)
166
-  (0.2ms) BEGIN
167
-  (0.5ms) ALTER TABLE "accounts" DROP COLUMN "customized_key"
168
- ActiveRecord::SchemaMigration Destroy (2.0ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = $1 [["version", "20190623220013"]]
169
-  (1.3ms) COMMIT
170
-  (0.8ms) SELECT pg_advisory_unlock(4021716121895623095)
171
-  (0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
172
-  (0.2ms) SELECT pg_try_advisory_lock(4021716121895623095)
173
-  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
174
- Migrating to AddCustomBookingSyncKeyIdToAccounts (20190623220013)
175
-  (0.2ms) BEGIN
176
-  (0.7ms) ALTER TABLE "accounts" ADD "customized_key" integer
177
- ActiveRecord::SchemaMigration Create (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20190623220013"]]
178
-  (2.1ms) COMMIT
179
- Migrating to AddCustomBookingSyncKeyIdToMultiApplicationsAccounts (20190623220132)
180
-  (0.2ms) BEGIN
181
-  (0.3ms) ALTER TABLE "multi_applications_accounts" ADD "customized_key" integer
182
- ActiveRecord::SchemaMigration Create (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20190623220132"]]
183
-  (0.5ms) COMMIT
184
- ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
185
-  (0.2ms) BEGIN
186
-  (0.1ms) COMMIT
187
-  (0.2ms) SELECT pg_advisory_unlock(4021716121895623095)
188
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
189
-  (1175.0ms) CREATE DATABASE "bookingsync_engine_development" ENCODING = 'unicode'
190
-  (825.0ms) CREATE DATABASE "bookingsync_engine_test" ENCODING = 'unicode'
191
- SQL (12.2ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
192
-  (6.9ms) DROP TABLE IF EXISTS "accounts" CASCADE
193
-  (162.5ms) CREATE TABLE "accounts" ("id" bigserial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "provider" character varying, "synced_id" integer, "name" character varying, "oauth_access_token" character varying, "oauth_refresh_token" character varying, "oauth_expires_at" character varying)
194
-  (2.5ms) CREATE INDEX "index_accounts_on_synced_id" ON "accounts" ("synced_id")
195
-  (0.2ms) DROP TABLE IF EXISTS "applications" CASCADE
196
-  (5.7ms) CREATE TABLE "applications" ("id" bigserial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "host" character varying NOT NULL, "client_id" text NOT NULL, "client_secret" text NOT NULL)
197
-  (10.9ms) CREATE UNIQUE INDEX "index_applications_on_client_id" ON "applications" ("client_id")
198
-  (2.3ms) CREATE UNIQUE INDEX "index_applications_on_client_secret" ON "applications" ("client_secret")
199
-  (2.2ms) CREATE UNIQUE INDEX "index_applications_on_host" ON "applications" ("host")
200
-  (0.2ms) DROP TABLE IF EXISTS "multi_applications_accounts" CASCADE
201
-  (10.8ms) CREATE TABLE "multi_applications_accounts" ("id" bigserial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "provider" character varying, "synced_id" integer, "name" character varying, "oauth_access_token" character varying, "oauth_refresh_token" character varying, "oauth_expires_at" character varying, "host" character varying NOT NULL)
202
-  (3.5ms) CREATE UNIQUE INDEX "index_multi_applications_accounts_on_host_and_synced_id" ON "multi_applications_accounts" ("host", "synced_id")
203
-  (5.2ms) CREATE INDEX "index_multi_applications_accounts_on_host" ON "multi_applications_accounts" ("host")
204
-  (2.9ms) CREATE INDEX "index_multi_applications_accounts_on_synced_id" ON "multi_applications_accounts" ("synced_id")
205
-  (5.9ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)
206
-  (2.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
207
-  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES (20181130063104)
208
-  (0.5ms) INSERT INTO "schema_migrations" (version) VALUES
209
- (20140522110326),
210
- (20140522110454),
211
- (20181130062531),
212
- (20181130062650),
213
- (20181130063056);
214
-
215
- 
216
-  (5.4ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp(6) NOT NULL, "updated_at" timestamp(6) NOT NULL)
217
- ActiveRecord::InternalMetadata Load (1.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
218
-  (0.3ms) BEGIN
219
- ActiveRecord::InternalMetadata Create (1.2ms) 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-03-25 16:17:19.875839"], ["updated_at", "2020-03-25 16:17:19.875839"]]
220
-  (0.3ms) COMMIT
221
- ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
222
- ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "schema_sha1"], ["LIMIT", 1]]
223
-  (0.1ms) BEGIN
224
- ActiveRecord::InternalMetadata Create (0.2ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "schema_sha1"], ["value", "755874218b611b67fce72928f68517992e40a98e"], ["created_at", "2020-03-25 16:17:19.882233"], ["updated_at", "2020-03-25 16:17:19.882233"]]
225
-  (0.4ms) COMMIT
226
- SQL (3.5ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
227
-  (0.2ms) DROP TABLE IF EXISTS "accounts" CASCADE
228
-  (64.5ms) CREATE TABLE "accounts" ("id" bigserial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "provider" character varying, "synced_id" integer, "name" character varying, "oauth_access_token" character varying, "oauth_refresh_token" character varying, "oauth_expires_at" character varying)
229
-  (3.8ms) CREATE INDEX "index_accounts_on_synced_id" ON "accounts" ("synced_id")
230
-  (0.2ms) DROP TABLE IF EXISTS "applications" CASCADE
231
-  (6.5ms) CREATE TABLE "applications" ("id" bigserial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "host" character varying NOT NULL, "client_id" text NOT NULL, "client_secret" text NOT NULL)
232
-  (12.6ms) CREATE UNIQUE INDEX "index_applications_on_client_id" ON "applications" ("client_id")
233
-  (2.5ms) CREATE UNIQUE INDEX "index_applications_on_client_secret" ON "applications" ("client_secret")
234
-  (2.6ms) CREATE UNIQUE INDEX "index_applications_on_host" ON "applications" ("host")
235
-  (0.2ms) DROP TABLE IF EXISTS "multi_applications_accounts" CASCADE
236
-  (6.3ms) CREATE TABLE "multi_applications_accounts" ("id" bigserial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "provider" character varying, "synced_id" integer, "name" character varying, "oauth_access_token" character varying, "oauth_refresh_token" character varying, "oauth_expires_at" character varying, "host" character varying NOT NULL)
237
-  (2.4ms) CREATE UNIQUE INDEX "index_multi_applications_accounts_on_host_and_synced_id" ON "multi_applications_accounts" ("host", "synced_id")
238
-  (11.9ms) CREATE INDEX "index_multi_applications_accounts_on_host" ON "multi_applications_accounts" ("host")
239
-  (14.4ms) CREATE INDEX "index_multi_applications_accounts_on_synced_id" ON "multi_applications_accounts" ("synced_id")
240
-  (9.9ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)
241
-  (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
242
-  (5.0ms) INSERT INTO "schema_migrations" (version) VALUES (20181130063104)
243
-  (6.0ms) INSERT INTO "schema_migrations" (version) VALUES
244
- (20140522110326),
245
- (20140522110454),
246
- (20181130062531),
247
- (20181130062650),
248
- (20181130063056);
249
-
250
- 
251
-  (10.2ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp(6) NOT NULL, "updated_at" timestamp(6) NOT NULL)
252
- 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]]
253
-  (0.1ms) BEGIN
254
- ActiveRecord::InternalMetadata Create (0.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", "2020-03-25 16:17:20.128664"], ["updated_at", "2020-03-25 16:17:20.128664"]]
255
-  (0.5ms) COMMIT
256
- ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
257
-  (0.1ms) BEGIN
258
- ActiveRecord::InternalMetadata Update (1.3ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2020-03-25 16:17:20.132397"], ["key", "environment"]]
259
-  (0.4ms) COMMIT
260
- ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "schema_sha1"], ["LIMIT", 1]]
261
-  (0.1ms) BEGIN
262
- ActiveRecord::InternalMetadata Create (0.2ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "schema_sha1"], ["value", "755874218b611b67fce72928f68517992e40a98e"], ["created_at", "2020-03-25 16:17:20.136794"], ["updated_at", "2020-03-25 16:17:20.136794"]]
263
-  (0.3ms) COMMIT
1
+  (550.3ms) CREATE DATABASE "bookingsync_engine_development" ENCODING = 'unicode'
2
+  (356.4ms) CREATE DATABASE "bookingsync_engine_test" ENCODING = 'unicode'