chrono_model 0.9.1 → 0.9.2

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
  SHA1:
3
- metadata.gz: cee551e571642d52fea58087df5f10e7462867ed
4
- data.tar.gz: e1e4ba037b6fdda2b322743d777e0ba5fab27109
3
+ metadata.gz: 4e2c2ec8b0a57f2078ffabc946175c86b70b7201
4
+ data.tar.gz: 6ad882f7558a940c9e3766e5abf6a6101107ffd2
5
5
  SHA512:
6
- metadata.gz: 105ae80bfc9669dba6eadee46d113d5c57276924cb2d702fde777a75a628c297ade0acf338bfc7fcce418676938c20bb66e371866c4f1763c81f5d7ec03926e0
7
- data.tar.gz: 5285cbce3977b45c8580e649a859ea16c42a69871b9a8a7a23f2a6225db808fba5439754c84d24e86ec2ca920c4558a1eabffade89953104aa777da1f38d2e57
6
+ metadata.gz: 92eff9be8173deeb5092553a23403ff87918b5c993338825a79783470b74ec0988419ecc5f3c62075da785954e353f0d1f9447301c8c8b21349e7f9fc312788c
7
+ data.tar.gz: d62529c7d3c49aae5dde87ab4304377bdc290dffa7054b2fca4c421f6a7042b001cc4cf3dd7237af45bb81210c406488491b837661f0652b4c906faac647b854
data/.travis.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  rvm:
2
- - 1.9.3
3
2
  - 2.0.0
4
- - 2.1.7
5
- - 2.2.3
3
+ - 2.1
4
+ - 2.2.5
5
+ - 2.3.1
6
6
 
7
7
  sudo: false
8
8
 
data/README.md CHANGED
@@ -285,10 +285,6 @@ offers many more indexing abilities and better performance than JSON.
285
285
  [is broken][r4-tsrange-broken] and [incomplete][r4-tsrange-incomplete]
286
286
  as of now, mainly due to a [design clash with ruby][pg-tsrange-and-ruby].
287
287
 
288
- * There is (yet) no upgrade path from [v0.5][chronomodel-0.5],
289
- (PG 9.0-compatible, `box()` and hacks) to v0.6 and up (>=9.3-only, `tsrange`
290
- and _less_ hacks).
291
-
292
288
  * The triggers and temporal indexes cannot be saved in schema.rb. The AR
293
289
  schema dumper is quite basic, and it isn't (currently) extensible.
294
290
  As we're using many database-specific features, Chronomodel forces the
data/chrono_model.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
21
21
 
22
22
  gem.add_development_dependency 'pry'
23
23
  gem.add_development_dependency 'hirb'
24
- gem.add_development_dependency RUBY_VERSION.to_f == 1.9 ? 'debugger' : 'byebug'
24
+ gem.add_development_dependency 'byebug'
25
25
  gem.add_development_dependency 'rspec'
26
26
  gem.add_development_dependency 'rake'
27
27
  gem.add_development_dependency 'fuubar'
data/lib/chrono_model.rb CHANGED
@@ -14,33 +14,11 @@ if defined?(Rails)
14
14
  require 'chrono_model/railtie'
15
15
  end
16
16
 
17
- # We need to override the "scoped" method on AR::Association for temporal
18
- # associations to work. On Ruby 2.0 and up, the Module#prepend comes in
19
- # handy - on Ruby 1.9 we have to hack the inheritance hierarchy.
20
- #
21
17
 
22
- if RUBY_VERSION.to_i >= 2
23
- ActiveRecord::Associations::Association.instance_eval do
24
- prepend ChronoModel::Patches::Association
25
- end
26
-
27
- ActiveRecord::Relation.instance_eval do
28
- prepend ChronoModel::Patches::Relation
29
- end
30
- else
31
- ActiveSupport::Deprecation.warn 'Ruby 1.9 is deprecated. Please update your Ruby <3'
32
-
33
- silence_warnings do
34
- class ChronoModel::Patches::AssociationPatch < ActiveRecord::Associations::Association
35
- include ChronoModel::Patches::Association
36
- end
37
-
38
- ActiveRecord::Associations::Association = ChronoModel::Patches::AssociationPatch
39
-
40
- class ChronoModel::Patches::RelationPatch < ActiveRecord::Relation
41
- include ChronoModel::Patches::Relation
42
- end
18
+ ActiveRecord::Associations::Association.instance_eval do
19
+ prepend ChronoModel::Patches::Association
20
+ end
43
21
 
44
- ActiveRecord::Relation = ChronoModel::Patches::RelationPatch
45
- end
22
+ ActiveRecord::Relation.instance_eval do
23
+ prepend ChronoModel::Patches::Relation
46
24
  end
@@ -6,20 +6,21 @@ namespace :db do
6
6
  task :dump => :environment do
7
7
  config = PG.config!
8
8
  target = ENV['DB_STRUCTURE'] || Rails.root.join('db', 'structure.sql')
9
- schema_search_path = config[:schema_search_path]
9
+ schema = config[:schema_search_path]
10
10
 
11
- unless schema_search_path.blank?
12
- # add in chronomodel schemas
13
- schema_search_path << ",#{ChronoModel::Adapter::TEMPORAL_SCHEMA}"
14
- schema_search_path << ",#{ChronoModel::Adapter::HISTORY_SCHEMA}"
15
-
16
- # convert to command line arguments
17
- schema_search_path = schema_search_path.split(",").map{|part| "--schema=#{part.strip}" }.join(" ")
11
+ if schema.present?
12
+ # If a schema search path is configured, add also the ChronoModel schemas to the dump.
13
+ #
14
+ schema = schema.split /\s*,\s*/
15
+ schema = schema.concat [ ChronoModel::Adapter::TEMPORAL_SCHEMA, ChronoModel::Adapter::HISTORY_SCHEMA ]
16
+ schema = schema.map {|name| "--schema=#{name}" }
17
+ else
18
+ schema = [ ]
18
19
  end
19
-
20
+
20
21
  PG.make_dump target,
21
22
  *config.values_at(:username, :database),
22
- '-i', '-x', '-s', '-O', schema_search_path
23
+ '-x', '-s', '-O', *schema
23
24
 
24
25
  # Add migration information, after resetting the schema to the default one
25
26
  File.open(target, 'a') do |f|
@@ -27,13 +28,13 @@ namespace :db do
27
28
  f.puts ActiveRecord::Base.connection.dump_schema_information
28
29
  end
29
30
 
30
- # the structure.sql file will contain CREATE SCHEMA statements
31
- # but chronomodel creates the temporal and history schemas
32
- # when the connection is established, so a db:structure:load fails
33
- # fix up create schema statements to include the IF NOT EXISTS directive
34
-
31
+ # The structure.sql includes CREATE SCHEMA statements, but as these are executed
32
+ # when the connection to the database is established, a db:structure:load fails.
33
+ # This code adds the IF NOT EXISTS clause to CREATE SCHEMA statements as long as
34
+ # it is not already present.
35
+ #
35
36
  sql = File.read(target)
36
- sql.gsub!(/CREATE SCHEMA /, 'CREATE SCHEMA IF NOT EXISTS ')
37
+ sql.gsub!(/CREATE SCHEMA (?!IF NOT EXISTS)/, '\&IF NOT EXISTS ')
37
38
  File.open(target, "w") { |file| file << sql }
38
39
  end
39
40
 
@@ -1,3 +1,3 @@
1
1
  module ChronoModel
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chrono_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcello Barnaba
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-20 00:00:00.000000000 Z
12
+ date: 2017-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord