lca 0.2.9 → 0.3

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: ae08a160b647985c85ef3181992f091ac978411c2409bc23de69daf97a95e1a3
4
- data.tar.gz: 735cbda1c8bbde69c6b015d5d09f97fee07d7830de21978c40086910810e7d1f
3
+ metadata.gz: 4a856a2dadcc2f24d2668205c87824cf0efc26dc40b94011dbc37c644cc4e177
4
+ data.tar.gz: 4bd30ccb55f50fd474b84372e0e08bbd29efabf1ec393a489bd8ac97dfb7e8fa
5
5
  SHA512:
6
- metadata.gz: 794b1b5deb3ed8ed9e44d0bf0252ddb7144e9dab733ec0ae6c28bb39d933317b1c28463c74d4a556dda9d91fbcc77ae1466a020bda7ba09aa15eb96a3336a451
7
- data.tar.gz: b7aa19cf60dfe5c510b206a9e00f4afbaee46168fe1e82860d3c82b39e966dc02613e4a49c9a2f2356a19c432e01eedd99ed82fa054ec5c771bc1402426a3725
6
+ metadata.gz: 35136a03613252f3c9d3f6297f68993f5d834a62241397a6f358ed26af3fdf715c083b8daf9a7776451d93e948e2a91e91e5cebc338ad29069e55d8c3d047424
7
+ data.tar.gz: ede6826e7116952fc7d25f4b71b1f05a503c499e839e9f3e61f768a4e48103d6ff6924f6c01a516c3e30bfe2038e20359cc5913264b710df9e012351c627b007
data/Gemfile CHANGED
@@ -8,6 +8,6 @@ gem "rake", "~> 13.0"
8
8
  gem "rspec", "~> 3.0"
9
9
 
10
10
  gem "activerecord", "~> 6.0"
11
- gem "active_tree", "~> 0.2.8"
11
+ gem "active_tree", "~> 0.3"
12
12
  gem "jwt"
13
13
  gem "pg_ltree"
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lca (0.2.8)
5
- active_tree (~> 0.2.8)
4
+ lca (0.3)
5
+ active_tree (~> 0.3)
6
6
  activerecord (~> 6.0)
7
7
  jwt (~> 2.2.3)
8
8
  pg_ltree (~> 1.1.8)
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- active_tree (0.2.9)
13
+ active_tree (0.3)
14
14
  activerecord (~> 6.0)
15
15
  jwt (~> 2.2.3)
16
16
  pg_ltree (~> 1.1.8)
@@ -57,7 +57,7 @@ PLATFORMS
57
57
  x86_64-linux
58
58
 
59
59
  DEPENDENCIES
60
- active_tree (~> 0.2.8)
60
+ active_tree (~> 0.3)
61
61
  activerecord (~> 6.0)
62
62
  jwt
63
63
  lca!
@@ -66,4 +66,4 @@ DEPENDENCIES
66
66
  rspec (~> 3.0)
67
67
 
68
68
  BUNDLED WITH
69
- 2.2.27
69
+ 2.2.29
data/README.md CHANGED
@@ -28,8 +28,17 @@ Upon installing the gem you must run the ActiveTree install process in your Rail
28
28
 
29
29
  $ rails g active_tree:install
30
30
 
31
+
31
32
  This will generate a `config/active_tree.yml` which you may customize to your needs, an initializer and a migration file which you can also customize to add any database columns your models will require.
32
33
 
34
+ You must also run the LCA gem install generator:
35
+
36
+ $ rails g lca:install
37
+
38
+
39
+ This will create a migration file which you can edit to add your models' specific attributes.
40
+
41
+
33
42
  ## Usage
34
43
 
35
44
  Include the ActiveTree concern into one of your models which will own lifecycle trees (owner model):
@@ -46,7 +55,7 @@ This will extend your model and enable the following functionality:
46
55
  ```ruby
47
56
  # query with ActiveRecord syntax
48
57
  User.last.active_trees
49
- User.find_by(name: "Acme").lca_cycles.impacts.select("impact_unit, sum(impact_amount) as total_impact").group(:impact_unit)
58
+ User.find_by(name: "Acme").active_trees.impacts.select("impact_unit, sum(impact_amount) as total_impact").group(:impact_unit)
50
59
  User.last.active_trees.where(...)
51
60
  User.last.active_trees.where(...).group(...)
52
61
  User.last.active_trees.where(...).limit(...).offset(...)
@@ -87,6 +96,10 @@ To see what syntax to use for path traversal please check out the following reso
87
96
  * pg_ltree gem https://github.com/sjke/pg_ltree
88
97
  * Postgres ltree extension documentation https://www.postgresql.org/docs/9.1/ltree.html
89
98
 
99
+ ## Scalability
100
+
101
+ All LCA data can be stored into separate partitions using the ActiveTree partitioning feature. See `config/active_tree.yml` for table and partitioning naming and options.
102
+
90
103
  ## Caveats
91
104
 
92
105
  `pg_ltree` .child / .parent queries do not work across different models due to an ActiveRecord limitation that requires results to be related via inheritance.
@@ -1,13 +1,6 @@
1
1
  class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
 
4
- # enable ltree extension
5
- begin
6
- execute "create extension ltree"
7
- rescue
8
- p "LTREE was already enabled"
9
- end
10
-
11
4
  # add any columns required by your business model
12
5
  add_column ACTIVE_TREE_OPTIONS[:table_name], :impact_amount, :decimal
13
6
  add_column ACTIVE_TREE_OPTIONS[:table_name], :impact_amount_previous, :decimal
data/lib/lca/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lca
4
- VERSION = "0.2.9"
4
+ VERSION = "0.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick @ Earthster
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-08 00:00:00.000000000 Z
11
+ date: 2021-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.8
33
+ version: '0.3'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.2.8
40
+ version: '0.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pg_ltree
43
43
  requirement: !ruby/object:Gem::Requirement