oplogjam 0.1.0 → 0.1.1

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: f3e28985e83d5c6975c304d1c074123dcb76252d
4
- data.tar.gz: 47d3168f31751fe699f0cb1234e2e4d242dea7e4
3
+ metadata.gz: 7a88754d088c1ec7dd593b3a78203dab65dbbd68
4
+ data.tar.gz: a1113e56fe3d5984f59f38dcbf82f783194c4443
5
5
  SHA512:
6
- metadata.gz: f3f1c4c27bcffad1182bf376fa3bcab07735299deeaf750607bc9f4f6c42caa2e0cc38da30462636a0f8c2e07e7426ff9be02fb979570bf9383db1be12102d24
7
- data.tar.gz: 5888d3534fb4e01d200af5d3c562e7efe844419514f84c04dcd6901f94888f9137e529a2227d768125dbc70215ba701d5f6d550d8eb3e355fe7fc117a7ad6b1f
6
+ metadata.gz: 942b168ee61ef9d2b55c6f313436efd9aaf495a640abb4f1a7d1ddd6f52fe81e40355a3fd618bbe8b80735cc0b5b2811b64d3993a29a9fd9fd5dff5dfca88f4b
7
+ data.tar.gz: 54b56e0d1faad407489259cc84fe9c566ac014a0f71451f29c411989a04dcbd64a61cbc74e26d24e61fe402e52c166b2b773a55f02924a350a42f58ecf21c8a4
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Oplogjam [![Build Status](https://travis-ci.org/mudge/oplogjam.svg)](https://travis-ci.org/mudge/oplogjam)
2
2
 
3
- **Current version:** 0.1.0
3
+ **Current version:** 0.1.1
4
4
  **Supported Ruby versions:** 2.0, 2.1, 2.2
5
5
  **Supported MongoDB versions:** 2.4, 2.6, 3.0, 3.2, 3.4
6
6
  **Supported PostgreSQL versions:** 9.5, 9.6
@@ -86,7 +86,7 @@ With that specific use case in mind, I wanted to explore whether a library to _s
86
86
 
87
87
  ## Why doesn't this project come with some sort of executable?
88
88
 
89
- While the library is more opinionated about the data schema of PostgreSQL, it doesn't attempt to make any decisions about how you decide which collections you want to replicate and where they should be replicated to. Similarly, connecting to databases, logging, etc. are all left up to the user as something that can might differ wildly.
89
+ While the library is more opinionated about the data schema of PostgreSQL, it doesn't attempt to make any decisions about how you decide which collections you want to replicate and where they should be replicated to. Similarly, connecting to databases, logging, etc. are all left up to the user as something that can differ wildly.
90
90
 
91
91
  While in future I may add an executable, for now this is up to the user to manage.
92
92
 
@@ -229,13 +229,13 @@ Note that the `name` may be a single `String`, `Symbol` or a [Sequel qualified i
229
229
 
230
230
  If the indexes already exist on the given table, the method will do nothing.
231
231
 
232
- #### `Oplogjam::Schema#import(collection, name)`
232
+ #### `Oplogjam::Schema#import(collection, name[, batch_size = 100])`
233
233
 
234
234
  ```ruby
235
235
  schema.import(mongo[:bar], :foo_bar)
236
236
  ```
237
237
 
238
- Batch import all existing documents from a given [`Mongo::Collection`](http://api.mongodb.com/ruby/current/Mongo/Collection.html) `collection` into the PostgreSQL table with the given `name`. Note that the `name` may be a single `String`, `Symbol` or [Sequel qualified identifier](https://github.com/jeremyevans/sequel/blob/master/doc/sql.rdoc#identifiers) if you're using PostgreSQL schema.
238
+ Import all existing documents from a given [`Mongo::Collection`](http://api.mongodb.com/ruby/current/Mongo/Collection.html) `collection` into the PostgreSQL table with the given `name` in batches of `batch_size` (defaults to 100). Note that the `name` may be a single `String`, `Symbol` or [Sequel qualified identifier](https://github.com/jeremyevans/sequel/blob/master/doc/sql.rdoc#identifiers) if you're using PostgreSQL schema.
239
239
 
240
240
  For performance, it's better to import existing data _before_ adding indexes to the table (hence the separate [`create_table`](#oplogjamschemacreate_tablename) and [`add_indexes`](#oplogjamschemaadd_indexesname) methods).
241
241
 
@@ -40,7 +40,7 @@ module Oplogjam
40
40
  table = mapping[namespace]
41
41
  return unless table
42
42
 
43
- row_id = query.fetch(ID).to_json
43
+ row_id = Sequel.object_to_json(query.fetch(ID))
44
44
 
45
45
  table
46
46
  .where(id: row_id, deleted_at: nil)
@@ -40,7 +40,7 @@ module Oplogjam
40
40
  table = mapping[namespace]
41
41
  return unless table
42
42
 
43
- row_id = document.fetch(ID).to_json
43
+ row_id = Sequel.object_to_json(document.fetch(ID))
44
44
 
45
45
  table
46
46
  .insert_conflict(
@@ -4,7 +4,7 @@ module Oplogjam
4
4
  module Operators
5
5
  class FieldAssignment < Assignment
6
6
  def update(column)
7
- column.set(path, value.to_json)
7
+ column.set(path, Sequel.object_to_json(value))
8
8
  end
9
9
  end
10
10
  end
@@ -24,7 +24,7 @@ module Oplogjam
24
24
  )
25
25
  )
26
26
 
27
- populated_column.set(path, value.to_json)
27
+ populated_column.set(path, Sequel.object_to_json(value))
28
28
  end
29
29
 
30
30
  def index
@@ -45,7 +45,7 @@ module Oplogjam
45
45
  table = mapping[namespace]
46
46
  return unless table
47
47
 
48
- row_id = query.fetch(ID).to_json
48
+ row_id = Sequel.object_to_json(query.fetch(ID))
49
49
 
50
50
  table
51
51
  .where(id: row_id, deleted_at: nil)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oplogjam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Mucur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-13 00:00:00.000000000 Z
11
+ date: 2017-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bson