schema_plus 1.4.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 +8 -3
- data/lib/schema_plus/active_record/connection_adapters/postgresql_adapter.rb +1 -0
- data/lib/schema_plus/version.rb +1 -1
- data/schema_plus.gemspec +2 -1
- data/spec/views_spec.rb +3 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd63024eb3b8a4b7bb36531835ff82f9d12a460c
|
4
|
+
data.tar.gz: 562ec9f5158688f44dbab8684447072901d28353
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4861cf3dce2acd2d90955fbce6afe974c3bff1f999d0412b0a11d09beb301bff4843d703ec647772c101cadd3529fa0267e874a1d19ec476c0fefca68780a72f
|
7
|
+
data.tar.gz: 8463ee8647ba6a48a90f2c896e016191092d368518c0fa883ca256316d53a15def6b9bff3408b7067d8383dc9634440ce051fb4b62f50390dbbb62a428ffc101
|
data/README.md
CHANGED
@@ -17,15 +17,14 @@ For added rails DRYness see also the gems
|
|
17
17
|
|
18
18
|
SchemaPlus supports all combinations of:
|
19
19
|
|
20
|
-
* Rails 3.2, 4.0, and 4.1 (currently 4.1.0beta3)
|
20
|
+
* Rails/ActiveRecord 3.2, 4.0, and 4.1 (currently 4.1.0beta3)
|
21
21
|
* PostgreSQL, MySQL (using mysql2 gem; mysql gem only supported with Rails
|
22
22
|
3.2), or SQLite3 (using sqlite3 >= 3.7.7 which has foreign key support)
|
23
23
|
* MRI Ruby 1.9.3, 2.0.0, or 2.1.0
|
24
24
|
|
25
25
|
And also supports:
|
26
26
|
|
27
|
-
* jruby with Rails 3.2 and PostgreSQL or MySQL
|
28
|
-
|
27
|
+
* jruby with Rails/ActiveRecord 3.2 and PostgreSQL or MySQL
|
29
28
|
|
30
29
|
|
31
30
|
## Installation
|
@@ -224,6 +223,8 @@ the above views you can define
|
|
224
223
|
class UncommentedPost < ActiveRecord::Base
|
225
224
|
end
|
226
225
|
|
226
|
+
Note: In Postgres, all internal views (the ones with `pg_` prefix) will be skipped.
|
227
|
+
|
227
228
|
### Column Defaults: Expressions
|
228
229
|
|
229
230
|
SchemaPlus allows defaults to be set using expressions or constant values:
|
@@ -297,6 +298,10 @@ of foreign key constraints, you can re-enable it:
|
|
297
298
|
|
298
299
|
* *nothing currently waiting to be released*
|
299
300
|
|
301
|
+
### 1.5.0
|
302
|
+
* Can now be used with activerecord standalone, doesn't need all of rails.
|
303
|
+
* `views` ignores postgres internal views, thanks to [@everplays](https://github.com/everplays) (issue #147)
|
304
|
+
|
300
305
|
### 1.4.1
|
301
306
|
|
302
307
|
* Bug fixes `migration.add_references` with `polymophic: true` (issue #145 and others)
|
@@ -265,6 +265,7 @@ module SchemaPlus
|
|
265
265
|
SELECT viewname
|
266
266
|
FROM pg_views
|
267
267
|
WHERE schemaname = ANY (current_schemas(false))
|
268
|
+
AND viewname NOT LIKE 'pg\_%'
|
268
269
|
SQL
|
269
270
|
sql += " AND schemaname != 'postgis'" if adapter_name == 'PostGIS'
|
270
271
|
query(sql, name).map { |row| row[0] }
|
data/lib/schema_plus/version.rb
CHANGED
data/schema_plus.gemspec
CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.homepage = "https://github.com/lomba/schema_plus"
|
13
13
|
s.summary = "Enhances ActiveRecord schema mechanism, including more DRY index creation and support for foreign key constraints and views."
|
14
14
|
s.description = "SchemaPlus is an ActiveRecord extension that provides enhanced capabilities for schema definition and querying, including: enhanced and more DRY index capabilities, support and automation for foreign key constraints, and support for views."
|
15
|
+
s.license = 'MIT'
|
15
16
|
|
16
17
|
s.rubyforge_project = "schema_plus"
|
17
18
|
|
@@ -20,7 +21,7 @@ Gem::Specification.new do |s|
|
|
20
21
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
22
|
s.require_paths = ["lib"]
|
22
23
|
|
23
|
-
s.add_dependency("
|
24
|
+
s.add_dependency("activerecord", ">= 3.2")
|
24
25
|
s.add_dependency("valuable")
|
25
26
|
|
26
27
|
s.add_development_dependency("rake")
|
data/spec/views_spec.rb
CHANGED
@@ -38,6 +38,7 @@ describe ActiveRecord do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should instrospect" do
|
41
|
+
# for postgresql, ignore views named pg_*
|
41
42
|
connection.views.sort.should == %W[a_ones ab_ones]
|
42
43
|
connection.view_definition('a_ones').should match(%r{^SELECT .*b.*,.*s.* FROM .*items.* WHERE .*a.* = 1}i)
|
43
44
|
connection.view_definition('ab_ones').should match(%r{^SELECT .*s.* FROM .*a_ones.* WHERE .*b.* = 1}i)
|
@@ -142,6 +143,7 @@ describe ActiveRecord do
|
|
142
143
|
|
143
144
|
create_view :a_ones, Item.select('b, s').where(:a => 1)
|
144
145
|
create_view :ab_ones, "select s from a_ones where b = 1"
|
146
|
+
create_view :pg_dummy_internal, "select 1" if SchemaPlusHelpers.postgresql?
|
145
147
|
end
|
146
148
|
end
|
147
149
|
connection.execute "insert into items (a, b, s) values (1, 1, 'one_one')"
|
@@ -157,6 +159,7 @@ describe ActiveRecord do
|
|
157
159
|
drop_view "ab_ones"
|
158
160
|
drop_view "a_ones"
|
159
161
|
drop_table "items"
|
162
|
+
drop_view :pg_dummy_internal if SchemaPlusHelpers.postgresql?
|
160
163
|
end
|
161
164
|
end
|
162
165
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schema_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ronen Barzel
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: activerecord
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - '>='
|
@@ -191,7 +191,8 @@ files:
|
|
191
191
|
- spec/support/matchers/reference.rb
|
192
192
|
- spec/views_spec.rb
|
193
193
|
homepage: https://github.com/lomba/schema_plus
|
194
|
-
licenses:
|
194
|
+
licenses:
|
195
|
+
- MIT
|
195
196
|
metadata: {}
|
196
197
|
post_install_message:
|
197
198
|
rdoc_options: []
|