dbview_cti 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/dbview_cti.gemspec +3 -1
- data/lib/db_view_cti/connection_adapters/schema_statements.rb +6 -2
- data/lib/db_view_cti/version.rb +1 -1
- data/spec/dummy-rails-3/db/migrate/20130711214909_create_vehicles.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20130713133605_create_motor_vehicles.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20130713133705_create_cars.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20130713153631_create_motor_cycles.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20130816022112_create_categories.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20130816022212_create_space_ships.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20130817014120_create_space_shuttles.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20130817024220_create_rocket_engines.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20130819040414_add_reliability_to_space_ships.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20131021211442_create_launches.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20131022010731_create_captains.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20131022020536_create_astronauts.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20131022020655_create_habtm_join_table.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20131022030659_create_experiments.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20131022030720_create_experiment_space_ship_performances.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20140408013710_check_view_exists.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/20140411001620_add_upgraded_from_to_space_shuttles.rb +8 -2
- data/spec/dummy-rails-3/db/migrate/20140425182847_add_field_to_base_class.rb +3 -1
- data/spec/dummy-rails-3/db/migrate/migration_helper.rb +15 -0
- data/spec/dummy-rails-3/spec +1 -0
- data/spec/dummy-rails-4/app/models +1 -0
- data/spec/dummy-rails-4/config/database.yml +1 -0
- data/spec/dummy-rails-4/config/initializers/dbview_cti.rb +1 -0
- data/spec/dummy-rails-4/db/migrate +1 -0
- data/spec/dummy-rails-4/spec +1 -0
- data/spec/dummy-rails-5/app/models +1 -0
- data/spec/dummy-rails-5/db/migrate +1 -0
- metadata +10 -17
- data/spec/dummy-rails-4/config/database.yml +0 -37
- data/spec/dummy-rails-4/config/initializers/dbview_cti.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7336700b3f30a53a54fa7e7c6e9cb9a68cad650b
|
4
|
+
data.tar.gz: 26f259b954a16441285911e82457f733f735afa4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d29f00ee7190def8971c8f9cf74793beac431378eec9baec22e1a15f32407a6c6ff4b8279f8996f93406253570367a1388be494e76362908b2ee75bf7cb37ec
|
7
|
+
data.tar.gz: 6ee75762da5263b42eb4a644f4c97bc1fee9980484b601bca1ff4764f4c614a394ca9a3e8202cd5dbd52371ca714452c6cb52eb7757ed3af6a212f2baee42d52
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -5,7 +5,7 @@ This gem implements [Class Table Inheritance](http://martinfowler.com/eaaCatalog
|
|
5
5
|
for Rails, as an alternative to Single Table Inheritance (STI). The implementation is based on database views.
|
6
6
|
It allows you to combine polymorphism with database foreign key constraints.
|
7
7
|
|
8
|
-
Currently, only PostgreSQL (version >= 9.1) is supported. The gem supports Rails 3.2, 4.0, 4.1, 4.2 and 5.
|
8
|
+
Currently, only PostgreSQL (version >= 9.1) is supported. The gem supports Rails 3.2, 4.0, 4.1, 4.2, 5.0 and 5.1 apps running on
|
9
9
|
MRI (>= 1.9.3), Rubinius and JRuby in 1.9 mode.
|
10
10
|
|
11
11
|
## Installation
|
data/dbview_cti.gemspec
CHANGED
@@ -20,5 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency "rails", ">= 3.2.0"
|
21
21
|
|
22
22
|
s.add_development_dependency "rspec-rails", "~> 3.5"
|
23
|
-
|
23
|
+
if ENV["RAILS_VERSION"] && ENV["RAILS_VERSION"][0].to_i < 5
|
24
|
+
s.add_development_dependency "foreigner"
|
25
|
+
end
|
24
26
|
end
|
@@ -53,8 +53,12 @@ module DBViewCTI
|
|
53
53
|
# any column changes are reflected in the real table cache, but not in the
|
54
54
|
# view cache, so we have to make sure it is cleared
|
55
55
|
klass = class_name.constantize
|
56
|
-
|
57
|
-
|
56
|
+
if Rails::VERSION::MAJOR >= 5
|
57
|
+
klass.connection.schema_cache.clear_data_source_cache!(klass.table_name)
|
58
|
+
else
|
59
|
+
klass.connection.schema_cache.clear_table_cache!(klass.table_name)
|
60
|
+
end
|
61
|
+
klass.reset_column_information
|
58
62
|
end
|
59
63
|
|
60
64
|
end
|
data/lib/db_view_cti/version.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require_relative './migration_helper'
|
2
|
+
|
3
|
+
class AddReliabilityToSpaceShips < MigrationHelper.migration_base_class
|
2
4
|
def up
|
3
5
|
cti_recreate_views_after_change_to('SpaceShip') do
|
4
6
|
add_column(:space_ships, :reliability, :integer)
|
data/spec/dummy-rails-3/db/migrate/20131022030720_create_experiment_space_ship_performances.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require_relative './migration_helper'
|
2
|
+
|
3
|
+
class CreateExperimentSpaceShipPerformances < MigrationHelper.migration_base_class
|
2
4
|
def change
|
3
5
|
create_table :experiment_space_ship_performances do |t|
|
4
6
|
t.references :experiment
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require_relative './migration_helper'
|
2
|
+
|
3
|
+
class AddUpgradedFromToSpaceShuttles < MigrationHelper.migration_base_class
|
2
4
|
def up
|
3
5
|
cti_recreate_views_after_change_to('SpaceShuttle') do
|
4
6
|
add_column(:space_shuttles, :upgraded_from_id, :integer)
|
@@ -7,9 +9,13 @@ class AddUpgradedFromToSpaceShuttles < ActiveRecord::Migration
|
|
7
9
|
end
|
8
10
|
|
9
11
|
def down
|
12
|
+
if Rails::VERSION::MAJOR >= 5
|
13
|
+
remove_foreign_key :space_shuttles, :column => 'upgraded_from_id'
|
14
|
+
else
|
15
|
+
remove_foreign_key :space_shuttles, :space_ships, :column => 'upgraded_from_id'
|
16
|
+
end
|
10
17
|
cti_recreate_views_after_change_to('SpaceShuttle') do
|
11
18
|
remove_column(:space_shuttles, :upgraded_from_id)
|
12
19
|
end
|
13
|
-
remove_foreign_key :space_shuttles, :space_ships, :column => 'upgraded_from_id'
|
14
20
|
end
|
15
21
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require_relative './migration_helper'
|
2
|
+
|
3
|
+
class AddFieldToBaseClass < MigrationHelper.migration_base_class
|
2
4
|
def up
|
3
5
|
# this makes cti_recreate_views_after_change_to also works for the base class
|
4
6
|
cti_recreate_views_after_change_to('Vehicle') do
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module MigrationHelper
|
2
|
+
|
3
|
+
def self.migration_base_class
|
4
|
+
klass = ActiveRecord::Migration
|
5
|
+
|
6
|
+
if Rails::VERSION::MAJOR >= 5
|
7
|
+
if Rails::VERSION::MAJOR > 5 || Rails::VERSION::MINOR >= 1
|
8
|
+
klass = ActiveRecord::Migration[4.2]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
klass
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
spec/dummy-rails-3/../../spec
|
@@ -0,0 +1 @@
|
|
1
|
+
spec/dummy-rails-4/app/../../dummy-rails-3/app/models
|
@@ -0,0 +1 @@
|
|
1
|
+
spec/dummy-rails-4/config/../../dummy-rails-3/config/database.yml
|
@@ -0,0 +1 @@
|
|
1
|
+
spec/dummy-rails-4/config/initializers/../../../dummy-rails-3/config/initializers/dbview_cti.rb
|
@@ -0,0 +1 @@
|
|
1
|
+
spec/dummy-rails-4/db/../../dummy-rails-3/db/migrate
|
@@ -0,0 +1 @@
|
|
1
|
+
spec/dummy-rails-4/../../spec
|
@@ -0,0 +1 @@
|
|
1
|
+
spec/dummy-rails-5/app/../../dummy-rails-3/app/models
|
@@ -0,0 +1 @@
|
|
1
|
+
spec/dummy-rails-5/db/../../dummy-rails-3/db/migrate
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbview_cti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michaël Van Damme
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.5'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: foreigner
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
description: This gem implements Class Table Inheritance (CTI) for Rails using database
|
56
42
|
views.
|
57
43
|
email:
|
@@ -150,6 +136,7 @@ files:
|
|
150
136
|
- spec/dummy-rails-3/db/migrate/20140408013710_check_view_exists.rb
|
151
137
|
- spec/dummy-rails-3/db/migrate/20140411001620_add_upgraded_from_to_space_shuttles.rb
|
152
138
|
- spec/dummy-rails-3/db/migrate/20140425182847_add_field_to_base_class.rb
|
139
|
+
- spec/dummy-rails-3/db/migrate/migration_helper.rb
|
153
140
|
- spec/dummy-rails-3/db/schema.rb
|
154
141
|
- spec/dummy-rails-3/lib/assets/.gitkeep
|
155
142
|
- spec/dummy-rails-3/log/.gitkeep
|
@@ -158,6 +145,7 @@ files:
|
|
158
145
|
- spec/dummy-rails-3/public/500.html
|
159
146
|
- spec/dummy-rails-3/public/favicon.ico
|
160
147
|
- spec/dummy-rails-3/script/rails
|
148
|
+
- spec/dummy-rails-3/spec
|
161
149
|
- spec/dummy-rails-4/.rspec
|
162
150
|
- spec/dummy-rails-4/Rakefile
|
163
151
|
- spec/dummy-rails-4/app/assets/images/.keep
|
@@ -167,6 +155,7 @@ files:
|
|
167
155
|
- spec/dummy-rails-4/app/controllers/concerns/.keep
|
168
156
|
- spec/dummy-rails-4/app/helpers/application_helper.rb
|
169
157
|
- spec/dummy-rails-4/app/mailers/.keep
|
158
|
+
- spec/dummy-rails-4/app/models
|
170
159
|
- spec/dummy-rails-4/app/views/layouts/application.html.erb
|
171
160
|
- spec/dummy-rails-4/bin/bundle
|
172
161
|
- spec/dummy-rails-4/bin/rails
|
@@ -189,6 +178,7 @@ files:
|
|
189
178
|
- spec/dummy-rails-4/config/initializers/wrap_parameters.rb
|
190
179
|
- spec/dummy-rails-4/config/locales/en.yml
|
191
180
|
- spec/dummy-rails-4/config/routes.rb
|
181
|
+
- spec/dummy-rails-4/db/migrate
|
192
182
|
- spec/dummy-rails-4/db/schema.rb
|
193
183
|
- spec/dummy-rails-4/lib/assets/.keep
|
194
184
|
- spec/dummy-rails-4/log/.keep
|
@@ -196,6 +186,7 @@ files:
|
|
196
186
|
- spec/dummy-rails-4/public/422.html
|
197
187
|
- spec/dummy-rails-4/public/500.html
|
198
188
|
- spec/dummy-rails-4/public/favicon.ico
|
189
|
+
- spec/dummy-rails-4/spec
|
199
190
|
- spec/dummy-rails-5/Rakefile
|
200
191
|
- spec/dummy-rails-5/app/assets/config/manifest.js
|
201
192
|
- spec/dummy-rails-5/app/assets/images/.keep
|
@@ -210,6 +201,7 @@ files:
|
|
210
201
|
- spec/dummy-rails-5/app/helpers/application_helper.rb
|
211
202
|
- spec/dummy-rails-5/app/jobs/application_job.rb
|
212
203
|
- spec/dummy-rails-5/app/mailers/application_mailer.rb
|
204
|
+
- spec/dummy-rails-5/app/models
|
213
205
|
- spec/dummy-rails-5/app/models.original/application_record.rb
|
214
206
|
- spec/dummy-rails-5/app/models.original/concerns/.keep
|
215
207
|
- spec/dummy-rails-5/app/views/layouts/application.html.erb
|
@@ -245,6 +237,7 @@ files:
|
|
245
237
|
- spec/dummy-rails-5/config/routes.rb
|
246
238
|
- spec/dummy-rails-5/config/secrets.yml
|
247
239
|
- spec/dummy-rails-5/config/spring.rb
|
240
|
+
- spec/dummy-rails-5/db/migrate
|
248
241
|
- spec/dummy-rails-5/lib/assets/.keep
|
249
242
|
- spec/dummy-rails-5/log/.keep
|
250
243
|
- spec/dummy-rails-5/public/404.html
|
@@ -278,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
278
271
|
version: '0'
|
279
272
|
requirements: []
|
280
273
|
rubyforge_project:
|
281
|
-
rubygems_version: 2.
|
274
|
+
rubygems_version: 2.6.11
|
282
275
|
signing_key:
|
283
276
|
specification_version: 4
|
284
277
|
summary: Class Table Inheritance (CTI) for Rails.
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# SQLite version 3.x
|
2
|
-
# gem install sqlite3
|
3
|
-
#
|
4
|
-
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
-
# gem 'sqlite3'
|
6
|
-
#development:
|
7
|
-
# adapter: sqlite3
|
8
|
-
# database: db/development.sqlite3
|
9
|
-
# pool: 5
|
10
|
-
# timeout: 5000
|
11
|
-
|
12
|
-
development:
|
13
|
-
adapter: postgresql
|
14
|
-
encoding: utf8
|
15
|
-
pool: 5
|
16
|
-
database: dbview_cti
|
17
|
-
timeout: 5000
|
18
|
-
username: cti
|
19
|
-
password: cti
|
20
|
-
|
21
|
-
# Warning: The database defined as "test" will be erased and
|
22
|
-
# re-generated from your development database when you run "rake".
|
23
|
-
# Do not set this db to the same as development or production.
|
24
|
-
test:
|
25
|
-
adapter: postgresql
|
26
|
-
encoding: utf8
|
27
|
-
pool: 5
|
28
|
-
database: dbview_cti_test
|
29
|
-
timeout: 5000
|
30
|
-
username: cti
|
31
|
-
password: cti
|
32
|
-
|
33
|
-
production:
|
34
|
-
adapter: sqlite3
|
35
|
-
database: db/production.sqlite3
|
36
|
-
pool: 5
|
37
|
-
timeout: 5000
|