dbee-active_record 2.2.0 → 2.3.0

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
  SHA256:
3
- metadata.gz: a9ad362290b7ac95e9ad1c466868f81bad354df55b9772742c9bf6591f9f762d
4
- data.tar.gz: 0ff078fc8e40af83f984729f3320856af95cf95b3562f97bc17b0b8787342a12
3
+ metadata.gz: 6b68d2e6c79fa4d3bb1ff26726983750cc112f60af4355eee8795cd748d9be9c
4
+ data.tar.gz: 5e0a15f3f85f465d7bc6fc79a9c74c6847e72be6a5a4ac25ec626f54bec985c4
5
5
  SHA512:
6
- metadata.gz: 93b68e1d07bfe82c469d1169d7e94fa2dece7a7f32fc01adcf895356bdfa285d7d1352b1a37e3bd7b50e1023551160988b4dc7a49c97d904b1b4c37d77d1e676
7
- data.tar.gz: 44aa0eda58e8d5f50f9d99d1b44a81ade7781ba9cad9cf35b47e6b3dcab2f2699c69898e774b33c3a00c535b4927481b3bb62411856f607ff78b24e34dd320a5
6
+ metadata.gz: 23bb62872a7c2412f0e8745b392b93fbd0c5bc1c7cfaefdc6503f9add73566b774378a69efe82eea53ee9f20c461585d163b96cc715541133b825f4906f87b89
7
+ data.tar.gz: cff34e878e7abb09865d88893af53e4d578077742ed4768fcee6c612c546e44a5a4f340ea2f9f6051a60ce2a62d484fce411c15487a69da00ad04fa5cf8a512e
@@ -0,0 +1,84 @@
1
+ version: 2.1
2
+
3
+ orbs:
4
+ status_to_ms_teams: bluemarblepayroll/status_to_ms_teams_pure_bash@1.0.0
5
+
6
+ jobs:
7
+ build:
8
+ parameters:
9
+ use-bundler-cache:
10
+ type: boolean
11
+ default: true
12
+
13
+ docker:
14
+ - image: circleci/ruby:2.6.6-buster
15
+ environment:
16
+ FORBID_FOCUSED_SPECS: 1
17
+ AR_VERSION: 5
18
+ - image: mysql@sha256:f3515b6a6502d872d5a37db78e4d225c0fcbf8da65d1faf8ce4609c92e2cbaf0
19
+ environment:
20
+ MYSQL_DATABASE: dbee_test
21
+ MYSQL_ALLOW_EMPTY_PASSWORD: 1
22
+ MYSQL_USER: root
23
+ command:
24
+ mysqld --sql_mode=TRADITIONAL,NO_AUTO_VALUE_ON_ZERO
25
+ working_directory: ~/dbee-active_record
26
+ steps:
27
+ - checkout
28
+ - run: sudo apt-get --allow-releaseinfo-change update
29
+ - run: sudo apt-get update && sudo apt-get install -y git curl libmcrypt-dev default-mysql-client
30
+ - run: dockerize -wait tcp://localhost:3306 -timeout 1m
31
+ - run: cp spec/config/database.yaml.ci spec/config/database.yaml
32
+ - run: mysql -h 127.0.0.1 -u root -e 'CREATE DATABASE IF NOT EXISTS dbee_test;'
33
+
34
+ # TODO: wrap bundler caching logic into an Orb:
35
+ - when:
36
+ condition: << parameters.use-bundler-cache >>
37
+ steps:
38
+ - restore_cache:
39
+ key: v1.0.0-build-ruby-dependency-cache-{{ checksum "dbee-active_record.gemspec" }}-{{ checksum "Gemfile" }}-{{ checksum ".ruby-version" }}
40
+
41
+ - run: bundle install --path vendor/bundle
42
+
43
+ - when:
44
+ condition: << parameters.use-bundler-cache >>
45
+ steps:
46
+ - save_cache:
47
+ key: v1.0.0-build-ruby-dependency-cache-{{ checksum "dbee-active_record.gemspec" }}-{{ checksum "Gemfile" }}-{{ checksum ".ruby-version" }}
48
+ paths:
49
+ - vendor/bundle
50
+
51
+ - store_artifacts:
52
+ path: Gemfile.lock
53
+
54
+ - run: bundle exec rubocop
55
+
56
+ - run: COVERAGE=true bundle exec rspec -r rspec_junit_formatter --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
57
+
58
+ - store_test_results:
59
+ path: test-results
60
+
61
+ - store_artifacts:
62
+ path: coverage
63
+
64
+ - status_to_ms_teams/report:
65
+ webhook_url: $MS_TEAMS_WEBHOOK_URL
66
+
67
+ workflows:
68
+ version: 2.1
69
+ build:
70
+ jobs:
71
+ - build:
72
+ context: org-global
73
+ monthly-gem-dependency-refresh-check:
74
+ triggers:
75
+ - schedule:
76
+ cron: '0 0 1 * *'
77
+ filters:
78
+ branches:
79
+ only:
80
+ - master
81
+ jobs:
82
+ - build:
83
+ context: org-global
84
+ use-bundler-cache: false
data/.rubocop.yml CHANGED
@@ -6,7 +6,7 @@ Layout/LineLength:
6
6
  Max: 100
7
7
 
8
8
  Metrics/AbcSize:
9
- Max: 17
9
+ Max: 20
10
10
  Exclude:
11
11
  - spec/db_helper.rb
12
12
 
@@ -23,7 +23,7 @@ Metrics/BlockLength:
23
23
  - dbee-active_record.gemspec
24
24
 
25
25
  Metrics/ClassLength:
26
- Max: 140
26
+ Max: 150
27
27
 
28
28
  Metrics/MethodLength:
29
29
  Max: 25
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.6.6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 2.3.0 (October 4th, 2021)
2
+
3
+ ### Additions:
4
+
5
+ * Support for Dbee::Query#offset.
1
6
  # 2.2.0 (March 11th, 2021)
2
7
 
3
8
  ### Additions:
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Dbee Active Record Provider
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/dbee-active_record.svg)](https://badge.fury.io/rb/dbee-active_record) [![Build Status](https://travis-ci.org/bluemarblepayroll/dbee-active_record.svg?branch=master)](https://travis-ci.org/bluemarblepayroll/dbee-active_record) [![Maintainability](https://api.codeclimate.com/v1/badges/7f74a4e546bebb603cce/maintainability)](https://codeclimate.com/github/bluemarblepayroll/dbee-active_record/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/7f74a4e546bebb603cce/test_coverage)](https://codeclimate.com/github/bluemarblepayroll/dbee-active_record/test_coverage) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
3
+ [![CircleCI](https://circleci.com/bb/bluemarble-ondemand/dbee-active_record/tree/master.svg?style=svg&circle-token=088be69cf3978bc526add53690e4919eb2fcce5c)](https://circleci.com/bb/bluemarble-ondemand/dbee-active_record/tree/master)
4
4
 
5
5
  Dbee does not ship with a SQL generator by default. This library plugs into Dbee to provide SQL generation via ActiveRecord. Technically speaking: this library does not use ActiveRecord for anything except connection information. All actual SQL generation is performed using Arel. There is no actual coupling of your domain ActiveRecord subclasses to Dbee.
6
6
 
7
- This library is a plugin for [Dbee](https://github.com/bluemarblepayroll/dbee). The Dbee repositories README file contains information about how to use the Data Model and Query API's.
7
+ This library is a plugin for Dbee. The Dbee repositories README file contains information about how to use the Data Model and Query API's.
8
8
 
9
9
  ## Installation
10
10
 
@@ -76,7 +76,7 @@ Note: ensure you have proper authorization before trying to publish new versions
76
76
  After code changes have successfully gone through the Pull Request review process then the following steps should be followed for publishing new versions:
77
77
 
78
78
  1. Merge Pull Request into master
79
- 2. Update `lib/dbee-active_record/version.rb` using [semantic versioning](https://semver.org/)
79
+ 2. Update `version.rb` using [semantic versioning](https://semver.org/)
80
80
  3. Install dependencies: `bundle`
81
81
  4. Update `CHANGELOG.md` with release notes
82
82
  5. Commit & push master to remote and ensure CI builds master successfully
@@ -17,15 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.bindir = 'exe'
19
19
  s.executables = []
20
- s.homepage = 'https://github.com/bluemarblepayroll/dbee-active_record'
21
20
  s.license = 'MIT'
22
- s.metadata = {
23
- 'bug_tracker_uri' => 'https://github.com/bluemarblepayroll/dbee-active_record/issues',
24
- 'changelog_uri' => 'https://github.com/bluemarblepayroll/dbee-active_record/blob/master/CHANGELOG.md',
25
- 'documentation_uri' => 'https://www.rubydoc.info/gems/dbee-active_record',
26
- 'homepage_uri' => s.homepage,
27
- 'source_code_uri' => s.homepage
28
- }
29
21
 
30
22
  s.required_ruby_version = '>= 2.5'
31
23
 
@@ -42,7 +34,7 @@ Gem::Specification.new do |s|
42
34
  end
43
35
 
44
36
  s.add_dependency('activerecord', activerecord_version)
45
- s.add_dependency('dbee', '~>3')
37
+ s.add_dependency('dbee', '~>3', '>=3.1.0')
46
38
 
47
39
  s.add_development_dependency('guard-rspec', '~>4.7')
48
40
  s.add_development_dependency('mysql2', '~>0.5')
@@ -50,6 +42,7 @@ Gem::Specification.new do |s|
50
42
  s.add_development_dependency('pry-byebug')
51
43
  s.add_development_dependency('rake', '~> 13')
52
44
  s.add_development_dependency('rspec', '~> 3.8')
45
+ s.add_development_dependency('rspec_junit_formatter')
53
46
  s.add_development_dependency('rubocop', '~> 1')
54
47
  s.add_development_dependency('rubocop-rake')
55
48
  s.add_development_dependency('rubocop-rspec')
@@ -62,6 +62,7 @@ module Dbee
62
62
 
63
63
  add_partitioners(base_table, from_model.partitioners)
64
64
  add_limit(query.limit)
65
+ add_offset(query.offset)
65
66
 
66
67
  statement.group(group_by_columns) if requires_group_by && !group_by_columns.empty?
67
68
  end
@@ -140,6 +141,14 @@ module Dbee
140
141
  self
141
142
  end
142
143
 
144
+ def add_offset(offset)
145
+ offset = offset ? offset.to_i : nil
146
+
147
+ build(statement.skip(offset))
148
+
149
+ self
150
+ end
151
+
143
152
  def add_partitioners(table, partitioners)
144
153
  partitioners.each do |partitioner|
145
154
  arel_column = table[partitioner.name]
@@ -10,7 +10,7 @@
10
10
  module Dbee
11
11
  module Providers
12
12
  class ActiveRecordProvider
13
- VERSION = '2.2.0'
13
+ VERSION = '2.3.0'
14
14
  end
15
15
  end
16
16
  end
@@ -7,6 +7,7 @@ query:
7
7
  - key_path: members.id
8
8
  - key_path: members.account_number
9
9
  limit: 12
10
+ offset: 25
10
11
  sqlite_readable: |+
11
12
  SELECT
12
13
  "theaters"."id" AS 'id',
@@ -16,6 +17,7 @@ sqlite_readable: |+
16
17
  FROM "theaters" "theaters"
17
18
  LEFT OUTER JOIN "members" "members" ON "members"."tid" = "theaters"."id" AND "members"."partition" = "theaters"."partition"
18
19
  LIMIT 12
20
+ OFFSET 25
19
21
  sqlite_not_readable: |+
20
22
  SELECT
21
23
  "t0"."id" AS 'c0',
@@ -25,6 +27,7 @@ sqlite_not_readable: |+
25
27
  FROM "theaters" "t0"
26
28
  LEFT OUTER JOIN "members" "t1" ON "t1"."tid" = "t0"."id" AND "t1"."partition" = "t0"."partition"
27
29
  LIMIT 12
30
+ OFFSET 25
28
31
  mysql_readable: |+
29
32
  SELECT
30
33
  `theaters`.`id` AS 'id',
@@ -34,6 +37,7 @@ mysql_readable: |+
34
37
  FROM `theaters` `theaters`
35
38
  LEFT OUTER JOIN `members` `members` ON `members`.`tid` = `theaters`.`id` AND `members`.`partition` = `theaters`.`partition`
36
39
  LIMIT 12
40
+ OFFSET 25
37
41
  mysql_not_readable: |+
38
42
  SELECT
39
43
  `t0`.`id` AS 'c0',
@@ -43,3 +47,4 @@ mysql_not_readable: |+
43
47
  FROM `theaters` `t0`
44
48
  LEFT OUTER JOIN `members` `t1` ON `t1`.`tid` = `t0`.`id` AND `t1`.`partition` = `t0`.`partition`
45
49
  LIMIT 12
50
+ OFFSET 25
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbee-active_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ruggio
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-03-11 00:00:00.000000000 Z
12
+ date: 2021-10-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -38,6 +38,9 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3'
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 3.1.0
41
44
  type: :runtime
42
45
  prerelease: false
43
46
  version_requirements: !ruby/object:Gem::Requirement
@@ -45,6 +48,9 @@ dependencies:
45
48
  - - "~>"
46
49
  - !ruby/object:Gem::Version
47
50
  version: '3'
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 3.1.0
48
54
  - !ruby/object:Gem::Dependency
49
55
  name: guard-rspec
50
56
  requirement: !ruby/object:Gem::Requirement
@@ -129,6 +135,20 @@ dependencies:
129
135
  - - "~>"
130
136
  - !ruby/object:Gem::Version
131
137
  version: '3.8'
138
+ - !ruby/object:Gem::Dependency
139
+ name: rspec_junit_formatter
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
132
152
  - !ruby/object:Gem::Dependency
133
153
  name: rubocop
134
154
  requirement: !ruby/object:Gem::Requirement
@@ -236,11 +256,12 @@ executables: []
236
256
  extensions: []
237
257
  extra_rdoc_files: []
238
258
  files:
259
+ - ".circleci/config.yml"
239
260
  - ".editorconfig"
240
261
  - ".gitignore"
241
262
  - ".rubocop.yml"
242
263
  - ".ruby-version"
243
- - ".travis.yml"
264
+ - ".tool-versions"
244
265
  - CHANGELOG.md
245
266
  - CODE_OF_CONDUCT.md
246
267
  - Gemfile
@@ -283,15 +304,10 @@ files:
283
304
  - spec/fixtures/active_record_snapshots/two_table_query_with_pivoting.yaml
284
305
  - spec/fixtures/models.yaml
285
306
  - spec/spec_helper.rb
286
- homepage: https://github.com/bluemarblepayroll/dbee-active_record
307
+ homepage:
287
308
  licenses:
288
309
  - MIT
289
- metadata:
290
- bug_tracker_uri: https://github.com/bluemarblepayroll/dbee-active_record/issues
291
- changelog_uri: https://github.com/bluemarblepayroll/dbee-active_record/blob/master/CHANGELOG.md
292
- documentation_uri: https://www.rubydoc.info/gems/dbee-active_record
293
- homepage_uri: https://github.com/bluemarblepayroll/dbee-active_record
294
- source_code_uri: https://github.com/bluemarblepayroll/dbee-active_record
310
+ metadata: {}
295
311
  post_install_message:
296
312
  rdoc_options: []
297
313
  require_paths:
data/.travis.yml DELETED
@@ -1,32 +0,0 @@
1
- env:
2
- global:
3
- - CC_TEST_REPORTER_ID=036a8fd92cf0c323c9704c041015837d14889e47de936bab18287626ff3372c1
4
- - DISABLE_RSPEC_FOCUS=true
5
- language: ruby
6
- services:
7
- - mysql
8
- rvm:
9
- # Build on the latest stable of all supported Rubies (https://www.ruby-lang.org/en/downloads/):
10
- - 2.5.8
11
- - 2.6.6
12
- - 2.7.2
13
- env:
14
- - AR_VERSION=5
15
- - AR_VERSION=6
16
- cache: bundler
17
- before_script:
18
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
19
- - chmod +x ./cc-test-reporter
20
- - ./cc-test-reporter before-build
21
- - cp spec/config/database.yaml.ci spec/config/database.yaml
22
- - mysql -e 'CREATE DATABASE IF NOT EXISTS dbee_test;'
23
- script:
24
- - bundle exec rubocop
25
- - bundle exec rspec spec --format documentation
26
- after_script:
27
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
28
- addons:
29
- # https://docs.travis-ci.com/user/uploading-artifacts/
30
- artifacts:
31
- paths:
32
- - Gemfile.lock