vorpal 1.3.1 → 1.5.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 +4 -4
- data/README.md +1 -5
- data/lib/vorpal/driver/postgresql.rb +6 -3
- data/lib/vorpal/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '02685786f294b0dcf78479b2ade552b98d9320f1a8f602d6669d909ede3d0ef8'
|
4
|
+
data.tar.gz: 157ed8b8f7615e36db88f657de43d111a6cfb97bb325cc3a22e3cb70d0260aa3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c54689a714716646cf4056dcc1a153d411397abd4700e4dc0b34182f6fd2b140da36c1dc6aaa03570d41fb1d6c7e12df53bf66a356a543ffbbbf157e66a9173
|
7
|
+
data.tar.gz: fb60dc70f5be204191726c6b9d3d2c5c6210cc3116fa4a21b4ceffeb7f601a68844132cc43e12dd7b61aa9edbc3936da495cbec1ed470b58cee68e18d466b10b
|
data/README.md
CHANGED
@@ -52,7 +52,7 @@ class Branch
|
|
52
52
|
attr_accessor :tree
|
53
53
|
end
|
54
54
|
|
55
|
-
class Gardener
|
55
|
+
class Gardener < ActiveRecord::Base
|
56
56
|
end
|
57
57
|
|
58
58
|
class Tree
|
@@ -199,11 +199,7 @@ It also does not do some things that you might expect from other ORMs:
|
|
199
199
|
1. Only supports PostgreSQL.
|
200
200
|
|
201
201
|
## Future Enhancements
|
202
|
-
* Support for having foreign keys point to columns other than primary keys.
|
203
202
|
* Support for storing entity ids in a column called something other than "id".
|
204
|
-
* Nicer DSL for specifying attributes that have different names in the domain model than in the DB.
|
205
|
-
* Aggregate updated_at.
|
206
|
-
* Better support for value objects.
|
207
203
|
|
208
204
|
## FAQ
|
209
205
|
|
@@ -65,7 +65,10 @@ module Vorpal
|
|
65
65
|
# @param db_class [Class] A subclass of ActiveRecord::Base
|
66
66
|
# @return [[Integer]] An array of unused primary keys.
|
67
67
|
def get_primary_keys(db_class, count)
|
68
|
-
result = execute("select nextval($1) from generate_series(1,$2);", [
|
68
|
+
result = execute("select nextval($1) from generate_series(1,$2);", [
|
69
|
+
ActiveRecord::Relation::QueryAttribute.new("sequence_name", sequence_name(db_class), ActiveRecord::Type::String.new),
|
70
|
+
ActiveRecord::Relation::QueryAttribute.new("count", count, ActiveRecord::Type::Integer.new)
|
71
|
+
])
|
69
72
|
result.rows.map(&:first).map(&:to_i)
|
70
73
|
end
|
71
74
|
|
@@ -99,6 +102,7 @@ module Vorpal
|
|
99
102
|
|
100
103
|
db_class.vorpal_model_class_name = Util::StringUtils.escape_class_name(model_class.name)
|
101
104
|
db_class.table_name = table_name
|
105
|
+
db_class.primary_key = 'id'
|
102
106
|
db_class
|
103
107
|
end
|
104
108
|
|
@@ -139,12 +143,11 @@ module Vorpal
|
|
139
143
|
def sequence_name(db_class)
|
140
144
|
@sequence_names[db_class] ||= execute(
|
141
145
|
"SELECT substring(column_default from '''(.*)''') FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = $1 AND column_name = 'id' LIMIT 1",
|
142
|
-
[db_class.table_name]
|
146
|
+
[ActiveRecord::Relation::QueryAttribute.new("table_name", db_class.table_name, ActiveRecord::Type::String.new)]
|
143
147
|
).rows.first.first
|
144
148
|
end
|
145
149
|
|
146
150
|
def execute(sql, binds)
|
147
|
-
binds = binds.map { |row| [nil, row] }
|
148
151
|
ActiveRecord::Base.connection.exec_query(sql, 'SQL', binds)
|
149
152
|
end
|
150
153
|
end
|
data/lib/vorpal/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vorpal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Kirby
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simple_serializer
|