maestrano-connector-rails 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a244b15c87cbe928441cf9dab1591be7654ba85
4
- data.tar.gz: ba9c4664d925760e710c44c755cf67b7bd0c07cd
3
+ metadata.gz: c13bb79393ae9579e24ece570350fa0c0c75dc9a
4
+ data.tar.gz: 190acf9ea6c8b0a6cf4eac8d6c3f86edd50b0455
5
5
  SHA512:
6
- metadata.gz: 4676868cd1de7f86c3ac9cc594d5227e70a3bf651e4693f4c4dbc5f1e301bac70fa65ffdbf17b4ad79b8e51cb10a1305733fd919eb59f84020ca7802f6641a35
7
- data.tar.gz: 806e9113159ef49af0b6daf8d2b1808c72e8df07a0d44f08431c1c8e3ede5e1c00b2a60adf4d272f668cb3c109d14921c14bc7ed9d69948fe79e55893eb38215
6
+ metadata.gz: 3c971599312170cc42e6754ad7f7e386cc6df2d52fa1c78e5eec880ed5192e1a908c1afbc6be374e251a0912566409b77ac378d4c394528452bea29105ee0212
7
+ data.tar.gz: 7ad190b146864f5a2c27377d190131cdf11ee308a97c1a65fa82a172659b1fddcc899e02125f66ee52563f8c7873388240ed051d618bb3daa4d8b9f27fef0db7
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.9
1
+ 0.2.10
@@ -9,6 +9,14 @@ module Maestrano::Connector::Rails
9
9
  # * :connec_preemption => true|false : preemption is always|never given to connec in case of conflict (if not set, the most recently updated entity is kept)
10
10
  def perform(organization, opts)
11
11
  return unless organization.sync_enabled
12
+
13
+ # Check if previous synchronization is still running
14
+ previous_synchronization = Synchronization.where(organization_id: organization.id).order(created_at: :desc).first
15
+ if previous_synchronization && previous_synchronization.status == 'RUNNING'
16
+ ConnectorLogger.log('info', organization, "Previous synchronization is still running")
17
+ return
18
+ end
19
+
12
20
  ConnectorLogger.log('info', organization, "Start synchronization, opts=#{opts}")
13
21
  current_synchronization = Synchronization.create_running(organization)
14
22
 
@@ -85,32 +85,36 @@ module Maestrano::Connector::Rails::Concerns::Entity
85
85
  idmap = mapped_external_entity_with_idmap[:idmap]
86
86
 
87
87
  if idmap.connec_id.blank?
88
- connec_entity = self.create_entity_to_connec(connec_client, external_entity, connec_entity_name, organization)
89
- idmap.update_attributes(connec_id: connec_entity['id'], connec_entity: connec_entity_name.downcase, last_push_to_connec: Time.now)
88
+ connec_entity = self.create_connec_entity(connec_client, external_entity, connec_entity_name, organization)
89
+ idmap.update_attributes(connec_id: connec_entity['id'], connec_entity: connec_entity_name.downcase, last_push_to_connec: Time.now, message: nil)
90
90
  else
91
- connec_entity = self.update_entity_to_connec(connec_client, external_entity, idmap.connec_id, connec_entity_name, organization)
92
- idmap.update_attributes(last_push_to_connec: Time.now)
91
+ connec_entity = self.update_connec_entity(connec_client, external_entity, idmap.connec_id, connec_entity_name, organization)
92
+ idmap.update_attributes(last_push_to_connec: Time.now, message: nil)
93
93
  end
94
+
95
+ # Store Connec! error if any
96
+ idmap.update_attributes(message: connec_entity['errors'].first['title']) unless connec_entity.blank? || connec_entity['errors'].blank?
94
97
  end
95
98
  end
96
99
 
97
- def create_entity_to_connec(connec_client, mapped_external_entity, connec_entity_name, organization)
100
+ def create_connec_entity(connec_client, mapped_external_entity, connec_entity_name, organization)
98
101
  Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Sending create #{connec_entity_name}: #{mapped_external_entity} to Connec!")
99
102
  response = connec_client.post("/#{connec_entity_name.downcase.pluralize}", { "#{connec_entity_name.downcase.pluralize}".to_sym => mapped_external_entity })
100
103
  raise "No response received from Connec! when trying to create a #{self.connec_entity_name}" unless response
101
104
  JSON.parse(response.body)["#{connec_entity_name.downcase.pluralize}"]
102
105
  end
103
106
 
104
- def update_entity_to_connec(connec_client, mapped_external_entity, connec_id, connec_entity_name, organization)
107
+ def update_connec_entity(connec_client, mapped_external_entity, connec_id, connec_entity_name, organization)
105
108
  Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Sending update #{connec_entity_name}: #{mapped_external_entity} to Connec!")
106
109
  response = connec_client.put("/#{connec_entity_name.downcase.pluralize}/#{connec_id}", { "#{connec_entity_name.downcase.pluralize}".to_sym => mapped_external_entity })
107
110
  raise "No response received from Connec! when trying to update a #{self.connec_entity_name}" unless response
111
+ JSON.parse(response.body)["#{connec_entity_name.downcase.pluralize}"]
108
112
  end
109
113
 
110
114
  def map_to_external_with_idmap(entity, organization)
111
115
  idmap = Maestrano::Connector::Rails::IdMap.find_by(connec_id: entity['id'], connec_entity: self.connec_entity_name.downcase, organization_id: organization.id)
112
116
 
113
- if idmap && idmap.last_push_to_external && idmap.last_push_to_external > entity['updated_at']
117
+ if idmap && ((!idmap.to_external) || (idmap.last_push_to_external && idmap.last_push_to_external > entity['updated_at']))
114
118
  Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Discard Connec! #{self.connec_entity_name} : #{entity}")
115
119
  nil
116
120
  else
@@ -141,21 +145,26 @@ module Maestrano::Connector::Rails::Concerns::Entity
141
145
  idmap = mapped_connec_entity_with_idmap[:idmap]
142
146
  connec_entity = mapped_connec_entity_with_idmap[:entity]
143
147
 
144
- if idmap.external_id.blank?
145
- external_id = self.create_entity_to_external(external_client, connec_entity, external_entity_name, organization)
146
- idmap.update_attributes(external_id: external_id, external_entity: external_entity_name.downcase, last_push_to_external: Time.now)
147
- else
148
- self.update_entity_to_external(external_client, connec_entity, idmap.external_id, external_entity_name, organization)
149
- idmap.update_attributes(last_push_to_external: Time.now)
148
+ begin
149
+ if idmap.external_id.blank?
150
+ external_id = self.create_external_entity(external_client, connec_entity, external_entity_name, organization)
151
+ idmap.update_attributes(external_id: external_id, external_entity: external_entity_name.downcase, last_push_to_external: Time.now, message: nil)
152
+ else
153
+ self.update_external_entity(external_client, connec_entity, idmap.external_id, external_entity_name, organization)
154
+ idmap.update_attributes(last_push_to_external: Time.now, message: nil)
155
+ end
156
+ rescue => e
157
+ # Store External error
158
+ idmap.update_attributes(message: e.message)
150
159
  end
151
160
  end
152
161
 
153
- def create_entity_to_external(client, mapped_connec_entity, external_entity_name, organization)
162
+ def create_external_entity(client, mapped_connec_entity, external_entity_name, organization)
154
163
  Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Sending create #{external_entity_name}: #{mapped_connec_entity} to #{@@external_name}")
155
164
  raise "Not implemented"
156
165
  end
157
166
 
158
- def update_entity_to_external(client, mapped_connec_entity, external_id, external_entity_name, organization)
167
+ def update_external_entity(client, mapped_connec_entity, external_id, external_entity_name, organization)
159
168
  Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Sending update #{external_entity_name} (id=#{external_id}): #{mapped_connec_entity} to #{@@external_name}")
160
169
  raise "Not implemented"
161
170
  end
@@ -183,6 +192,9 @@ module Maestrano::Connector::Rails::Concerns::Entity
183
192
  next {entity: self.map_to_connec(entity, organization), idmap: Maestrano::Connector::Rails::IdMap.create(external_id: self.get_id_from_external_entity_hash(entity), external_entity: self.external_entity_name.downcase, organization_id: organization.id)}
184
193
  end
185
194
 
195
+ # Not pushing entity to Connec!
196
+ next nil unless idmap.to_connec
197
+
186
198
  # Entity has not been modified since its last push to connec!
187
199
  if idmap.last_push_to_connec && idmap.last_push_to_connec > self.get_last_update_date_from_external_entity_hash(entity)
188
200
  Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Discard #{@@external_name} #{self.external_entity_name} : #{entity}")
@@ -222,14 +234,18 @@ module Maestrano::Connector::Rails::Concerns::Entity
222
234
  # Entity specific methods
223
235
  # Those methods need to be define in each entity
224
236
  # ----------------------------------------------
237
+
238
+ # Entity name in Connec!
225
239
  def connec_entity_name
226
240
  raise "Not implemented"
227
241
  end
228
242
 
243
+ # Entity name in external system
229
244
  def external_entity_name
230
245
  raise "Not implemented"
231
246
  end
232
247
 
248
+ # Entity Mapper Class
233
249
  def mapper_class
234
250
  raise "Not implemented"
235
251
  end
@@ -0,0 +1,8 @@
1
+ class AddNameToIdMap < ActiveRecord::Migration
2
+ def change
3
+ add_column :id_maps, :to_connec, :boolean, default: true
4
+ add_column :id_maps, :to_external, :boolean, default: true
5
+ add_column :id_maps, :name, :string
6
+ add_column :id_maps, :message, :string
7
+ end
8
+ end
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: maestrano-connector-rails 0.2.9 ruby lib
5
+ # stub: maestrano-connector-rails 0.2.10 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "maestrano-connector-rails"
9
- s.version = "0.2.9"
9
+ s.version = "0.2.10"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -57,6 +57,7 @@ Gem::Specification.new do |s|
57
57
  "db/migrate/20151122163325_create_synchronizations.rb",
58
58
  "db/migrate/20151122163449_create_id_maps.rb",
59
59
  "db/migrate/20160205132857_add_sync_enabled_to_organizations.rb",
60
+ "db/migrate/20160215103120_add_name_to_id_map.rb",
60
61
  "lib/generators/connector/USAGE",
61
62
  "lib/generators/connector/complex_entity_generator.rb",
62
63
  "lib/generators/connector/install_generator.rb",
@@ -127,12 +128,6 @@ Gem::Specification.new do |s|
127
128
  "spec/dummy/config/routes.rb",
128
129
  "spec/dummy/config/secrets.yml",
129
130
  "spec/dummy/db/development.sqlite3",
130
- "spec/dummy/db/migrate/20160204223447_create_users.maestrano_connector_rails_engine.rb",
131
- "spec/dummy/db/migrate/20160204223448_create_organizations.maestrano_connector_rails_engine.rb",
132
- "spec/dummy/db/migrate/20160204223449_create_user_organization_rels.maestrano_connector_rails_engine.rb",
133
- "spec/dummy/db/migrate/20160204223450_create_synchronizations.maestrano_connector_rails_engine.rb",
134
- "spec/dummy/db/migrate/20160204223451_create_id_maps.maestrano_connector_rails_engine.rb",
135
- "spec/dummy/db/migrate/20160205133024_add_sync_enabled_to_organizations.maestrano_connector_rails_engine.rb",
136
131
  "spec/dummy/db/schema.rb",
137
132
  "spec/dummy/db/test.sqlite3",
138
133
  "spec/dummy/lib/assets/.keep",
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20160205133024) do
14
+ ActiveRecord::Schema.define(version: 20160215103120) do
15
15
 
16
16
  create_table "id_maps", force: :cascade do |t|
17
17
  t.string "connec_id"
@@ -21,8 +21,12 @@ ActiveRecord::Schema.define(version: 20160205133024) do
21
21
  t.integer "organization_id"
22
22
  t.datetime "last_push_to_connec"
23
23
  t.datetime "last_push_to_external"
24
- t.datetime "created_at", null: false
25
- t.datetime "updated_at", null: false
24
+ t.datetime "created_at", null: false
25
+ t.datetime "updated_at", null: false
26
+ t.boolean "to_connec", default: true
27
+ t.boolean "to_external", default: true
28
+ t.string "name"
29
+ t.string "message"
26
30
  end
27
31
 
28
32
  add_index "id_maps", ["connec_id", "connec_entity", "organization_id"], name: "idmap_connec_index"
Binary file
@@ -128,11 +128,11 @@ describe Maestrano::Connector::Rails::Entity do
128
128
  let(:id) { 'ab12-34re' }
129
129
 
130
130
  it 'create or update the entities and idmaps according to their idmap state' do
131
- allow(subject).to receive(:create_entity_to_connec).and_return({'id' => id})
131
+ allow(subject).to receive(:create_connec_entity).and_return({'id' => id})
132
132
  allow(subject).to receive(:external_entity_name).and_return(external_name)
133
133
 
134
- expect(subject).to receive(:create_entity_to_connec).with(client, entity2, connec_name, organization)
135
- expect(subject).to receive(:update_entity_to_connec).with(client, entity1, idmap1.connec_id, connec_name, organization)
134
+ expect(subject).to receive(:create_connec_entity).with(client, entity2, connec_name, organization)
135
+ expect(subject).to receive(:update_connec_entity).with(client, entity1, idmap1.connec_id, connec_name, organization)
136
136
  old_push_date = idmap1.last_push_to_connec
137
137
 
138
138
  subject.push_entities_to_connec_to(client, entities_with_idmaps, connec_name, organization)
@@ -146,7 +146,7 @@ describe Maestrano::Connector::Rails::Entity do
146
146
  end
147
147
  end
148
148
 
149
- describe 'create_entity_to_connec' do
149
+ describe 'create_connec_entity' do
150
150
  let(:entity) { {name: 'John'} }
151
151
 
152
152
  describe 'with a response' do
@@ -156,11 +156,11 @@ describe Maestrano::Connector::Rails::Entity do
156
156
 
157
157
  it 'sends a post to connec' do
158
158
  expect(client).to receive(:post).with("/#{connec_name.pluralize}", {"#{connec_name.pluralize}".to_sym => entity})
159
- subject.create_entity_to_connec(client, entity, connec_name, organization)
159
+ subject.create_connec_entity(client, entity, connec_name, organization)
160
160
  end
161
161
 
162
162
  it 'returns the created entity' do
163
- expect(subject.create_entity_to_connec(client, entity, connec_name, organization)).to eql(JSON.parse(entity.to_json))
163
+ expect(subject.create_connec_entity(client, entity, connec_name, organization)).to eql(JSON.parse(entity.to_json))
164
164
  end
165
165
  end
166
166
 
@@ -168,11 +168,11 @@ describe Maestrano::Connector::Rails::Entity do
168
168
  before {
169
169
  allow(client).to receive(:post).and_return(nil)
170
170
  }
171
- it { expect{ subject.create_entity_to_connec(client, entity, connec_name, organization) }.to raise_error("No response received from Connec! when trying to create a #{connec_name}") }
171
+ it { expect{ subject.create_connec_entity(client, entity, connec_name, organization) }.to raise_error("No response received from Connec! when trying to create a #{connec_name}") }
172
172
  end
173
173
  end
174
174
 
175
- describe 'update_entity_to_connec' do
175
+ describe 'update_connec_entity' do
176
176
  let(:organization) { create(:organization) }
177
177
  let(:entity) { {name: 'John'} }
178
178
  let(:id) { '88ye-777ab' }
@@ -184,7 +184,7 @@ describe Maestrano::Connector::Rails::Entity do
184
184
 
185
185
  it 'sends a put to connec' do
186
186
  expect(client).to receive(:put).with("/#{connec_name.pluralize}/#{id}", {"#{connec_name.pluralize}".to_sym => entity})
187
- subject.update_entity_to_connec(client, entity, id, connec_name, organization)
187
+ subject.update_connec_entity(client, entity, id, connec_name, organization)
188
188
  end
189
189
  end
190
190
 
@@ -192,7 +192,7 @@ describe Maestrano::Connector::Rails::Entity do
192
192
  before {
193
193
  allow(client).to receive(:put).and_return(nil)
194
194
  }
195
- it { expect{ subject.update_entity_to_connec(client, entity, id, connec_name, organization) }.to raise_error("No response received from Connec! when trying to update a #{connec_name}") }
195
+ it { expect{ subject.update_connec_entity(client, entity, id, connec_name, organization) }.to raise_error("No response received from Connec! when trying to update a #{connec_name}") }
196
196
  end
197
197
  end
198
198
 
@@ -273,13 +273,13 @@ describe Maestrano::Connector::Rails::Entity do
273
273
 
274
274
  describe 'push_entity_to_external' do
275
275
  context 'when the entity idmap has an external id' do
276
- it 'calls update_entity_to_external' do
277
- expect(subject).to receive(:update_entity_to_external).with(nil, entity1, idmap1.external_id, external_name, organization)
276
+ it 'calls update_external_entity' do
277
+ expect(subject).to receive(:update_external_entity).with(nil, entity1, idmap1.external_id, external_name, organization)
278
278
  subject.push_entity_to_external(nil, entity_with_idmap1, external_name, organization)
279
279
  end
280
280
 
281
281
  it 'updates the idmap last push to external' do
282
- allow(subject).to receive(:update_entity_to_external)
282
+ allow(subject).to receive(:update_external_entity)
283
283
  time_before = idmap1.last_push_to_external
284
284
  subject.push_entity_to_external(nil, entity_with_idmap1, external_name, organization)
285
285
  idmap1.reload
@@ -288,13 +288,13 @@ describe Maestrano::Connector::Rails::Entity do
288
288
  end
289
289
 
290
290
  context 'when the entity idmap does not have an external id' do
291
- it 'calls create_entity_to_external' do
292
- expect(subject).to receive(:create_entity_to_external).with(nil, entity2, external_name, organization)
291
+ it 'calls create_external_entity' do
292
+ expect(subject).to receive(:create_external_entity).with(nil, entity2, external_name, organization)
293
293
  subject.push_entity_to_external(nil, entity_with_idmap2, external_name, organization)
294
294
  end
295
295
 
296
296
  it 'updates the idmap external id, entity and last push' do
297
- allow(subject).to receive(:create_entity_to_external).and_return('999111')
297
+ allow(subject).to receive(:create_external_entity).and_return('999111')
298
298
  subject.push_entity_to_external(nil, entity_with_idmap2, external_name, organization)
299
299
  idmap2.reload
300
300
  expect(idmap2.external_id).to eql('999111')
@@ -304,16 +304,16 @@ describe Maestrano::Connector::Rails::Entity do
304
304
  end
305
305
  end
306
306
 
307
- describe 'create_entity_to_external' do
307
+ describe 'create_external_entity' do
308
308
  let(:organization) { create(:organization) }
309
309
 
310
- it { expect{ subject.create_entity_to_external(nil, nil, nil, organization) }.to raise_error('Not implemented') }
310
+ it { expect{ subject.create_external_entity(nil, nil, nil, organization) }.to raise_error('Not implemented') }
311
311
  end
312
312
 
313
- describe 'update_entity_to_external' do
313
+ describe 'update_external_entity' do
314
314
  let(:organization) { create(:organization) }
315
315
 
316
- it { expect{ subject.update_entity_to_external(nil, nil, nil, nil, organization) }.to raise_error('Not implemented') }
316
+ it { expect{ subject.update_external_entity(nil, nil, nil, nil, organization) }.to raise_error('Not implemented') }
317
317
  end
318
318
 
319
319
  describe 'get_id_from_external_entity_hash' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maestrano-connector-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Berard
@@ -225,6 +225,7 @@ files:
225
225
  - db/migrate/20151122163325_create_synchronizations.rb
226
226
  - db/migrate/20151122163449_create_id_maps.rb
227
227
  - db/migrate/20160205132857_add_sync_enabled_to_organizations.rb
228
+ - db/migrate/20160215103120_add_name_to_id_map.rb
228
229
  - lib/generators/connector/USAGE
229
230
  - lib/generators/connector/complex_entity_generator.rb
230
231
  - lib/generators/connector/install_generator.rb
@@ -295,12 +296,6 @@ files:
295
296
  - spec/dummy/config/routes.rb
296
297
  - spec/dummy/config/secrets.yml
297
298
  - spec/dummy/db/development.sqlite3
298
- - spec/dummy/db/migrate/20160204223447_create_users.maestrano_connector_rails_engine.rb
299
- - spec/dummy/db/migrate/20160204223448_create_organizations.maestrano_connector_rails_engine.rb
300
- - spec/dummy/db/migrate/20160204223449_create_user_organization_rels.maestrano_connector_rails_engine.rb
301
- - spec/dummy/db/migrate/20160204223450_create_synchronizations.maestrano_connector_rails_engine.rb
302
- - spec/dummy/db/migrate/20160204223451_create_id_maps.maestrano_connector_rails_engine.rb
303
- - spec/dummy/db/migrate/20160205133024_add_sync_enabled_to_organizations.maestrano_connector_rails_engine.rb
304
299
  - spec/dummy/db/schema.rb
305
300
  - spec/dummy/db/test.sqlite3
306
301
  - spec/dummy/lib/assets/.keep
@@ -1,17 +0,0 @@
1
- # This migration comes from maestrano_connector_rails_engine (originally 20151122162100)
2
- class CreateUsers < ActiveRecord::Migration
3
- def change
4
- create_table :users do |t|
5
- t.string :provider
6
- t.string :uid
7
- t.string :first_name
8
- t.string :last_name
9
- t.string :email
10
- t.string :tenant
11
-
12
- t.timestamps null: false
13
- end
14
-
15
- add_index :users, [:uid, :tenant], name: 'user_uid_index'
16
- end
17
- end
@@ -1,22 +0,0 @@
1
- # This migration comes from maestrano_connector_rails_engine (originally 20151122162414)
2
- class CreateOrganizations < ActiveRecord::Migration
3
- def change
4
- create_table :organizations do |t|
5
- t.string :provider
6
- t.string :uid
7
- t.string :name
8
- t.string :tenant
9
-
10
- t.string :oauth_provider
11
- t.string :oauth_uid
12
- t.string :oauth_token
13
- t.string :refresh_token
14
- t.string :instance_url
15
-
16
- t.string :synchronized_entities
17
-
18
- t.timestamps null: false
19
- end
20
- add_index :organizations, [:uid, :tenant], name: 'orga_uid_index'
21
- end
22
- end
@@ -1,13 +0,0 @@
1
- # This migration comes from maestrano_connector_rails_engine (originally 20151122162613)
2
- class CreateUserOrganizationRels < ActiveRecord::Migration
3
- def change
4
- create_table :user_organization_rels do |t|
5
- t.integer :user_id
6
- t.integer :organization_id
7
-
8
- t.timestamps
9
- end
10
- add_index :user_organization_rels, :organization_id, name: 'rels_orga_index'
11
- add_index :user_organization_rels, :user_id, name: 'rels_user_index'
12
- end
13
- end
@@ -1,14 +0,0 @@
1
- # This migration comes from maestrano_connector_rails_engine (originally 20151122163325)
2
- class CreateSynchronizations < ActiveRecord::Migration
3
- def change
4
- create_table :synchronizations do |t|
5
- t.integer :organization_id
6
- t.string :status
7
- t.text :message
8
- t.boolean :partial, default: false
9
-
10
- t.timestamps null: false
11
- end
12
- add_index :synchronizations, :organization_id, name: 'synchronization_orga_id_index'
13
- end
14
- end
@@ -1,19 +0,0 @@
1
- # This migration comes from maestrano_connector_rails_engine (originally 20151122163449)
2
- class CreateIdMaps < ActiveRecord::Migration
3
- def change
4
- create_table :id_maps do |t|
5
- t.string :connec_id
6
- t.string :connec_entity
7
- t.string :external_id
8
- t.string :external_entity
9
- t.integer :organization_id
10
- t.datetime :last_push_to_connec
11
- t.datetime :last_push_to_external
12
-
13
- t.timestamps null: false
14
- end
15
- add_index :id_maps, [:connec_id, :connec_entity, :organization_id], name: 'idmap_connec_index'
16
- add_index :id_maps, [:external_id, :external_entity, :organization_id], name: 'idmap_external_index'
17
- add_index :id_maps, :organization_id, name: 'idmap_organization_index'
18
- end
19
- end
@@ -1,6 +0,0 @@
1
- # This migration comes from maestrano_connector_rails_engine (originally 20160205132857)
2
- class AddSyncEnabledToOrganizations < ActiveRecord::Migration
3
- def change
4
- add_column :organizations, :sync_enabled, :boolean, default: false
5
- end
6
- end