activerecord 4.2.8 → 4.2.9.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +3 -4
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +2 -2
- data/lib/active_record/gem_version.rb +2 -2
- data/lib/active_record/migration.rb +30 -5
- data/lib/active_record/model_schema.rb +2 -0
- data/lib/active_record/railtie.rb +4 -2
- data/lib/active_record/railties/databases.rake +7 -17
- data/lib/active_record/relation/calculations.rb +1 -1
- data/lib/active_record/tasks/database_tasks.rb +2 -0
- data/lib/active_record/type/decimal.rb +7 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d9c3798eb0ff9c3bcdcb27e7ec7b036d1ade146
|
4
|
+
data.tar.gz: 2e0c593c891c33e92f468d09d087343e9cd145e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97f3561dc803595713da00b6945b8a7d40e280dc82cf23a4ff1db76baccd45f62c1a16aec80401e5717ce0ce95696d1ff1d39ab279dffa7c6329963d63f81ef5
|
7
|
+
data.tar.gz: 4449a60f51055fa7c52231bf06e2ad323e392433ce17ab64e8c7b827a7b3d06d8c017d9813f8a83357e2de6718176ddb3649421df920f27876521e3ddb0f2b5c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
## Rails 4.2.9.rc1 (June 13, 2017) ##
|
2
|
+
|
3
|
+
* Fix `rake db:schema:load` with subdirectories.
|
4
|
+
|
5
|
+
*Ryuta Kamizono*
|
6
|
+
|
7
|
+
* Fix `rake db:migrate:status` with subdirectories.
|
8
|
+
|
9
|
+
*Ryuta Kamizono*
|
10
|
+
|
11
|
+
* Fix regression of #1969 with SELECT aliases in HAVING clause.
|
12
|
+
|
13
|
+
*Eugene Kenny*
|
14
|
+
|
15
|
+
* Fix `wait_timeout` to configurable for mysql2 adapter.
|
16
|
+
|
17
|
+
Fixes #26556.
|
18
|
+
|
19
|
+
*Ryuta Kamizono*
|
20
|
+
|
21
|
+
* Make `table_name=` reset current statement cache,
|
22
|
+
so queries are not run against the previous table name.
|
23
|
+
|
24
|
+
*namusyaka*
|
25
|
+
|
26
|
+
|
1
27
|
## Rails 4.2.8 (February 21, 2017) ##
|
2
28
|
|
3
29
|
* Using a mysql2 connection after it fails to reconnect will now have an error message
|
@@ -841,10 +841,9 @@ module ActiveRecord
|
|
841
841
|
version = version.to_i
|
842
842
|
sm_table = quote_table_name(ActiveRecord::Migrator.schema_migrations_table_name)
|
843
843
|
|
844
|
-
migrated = select_values("SELECT version FROM #{sm_table}").map
|
845
|
-
|
846
|
-
|
847
|
-
filename.split('/').last.split('_').first.to_i
|
844
|
+
migrated = select_values("SELECT version FROM #{sm_table}").map(&:to_i)
|
845
|
+
versions = ActiveRecord::Migrator.migration_files(migrations_paths).map do |file|
|
846
|
+
ActiveRecord::Migrator.parse_migration_filename(file).first.to_i
|
848
847
|
end
|
849
848
|
|
850
849
|
unless migrated.include?(version)
|
@@ -863,9 +863,9 @@ module ActiveRecord
|
|
863
863
|
variables['sql_auto_is_null'] = 0
|
864
864
|
|
865
865
|
# Increase timeout so the server doesn't disconnect us.
|
866
|
-
wait_timeout = @config[:wait_timeout]
|
866
|
+
wait_timeout = self.class.type_cast_config_to_integer(@config[:wait_timeout])
|
867
867
|
wait_timeout = 2147483 unless wait_timeout.is_a?(Integer)
|
868
|
-
variables[
|
868
|
+
variables["wait_timeout"] = wait_timeout
|
869
869
|
|
870
870
|
# Make MySQL reject illegal values rather than truncating or blanking them, see
|
871
871
|
# http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_strict_all_tables
|
@@ -880,14 +880,15 @@ module ActiveRecord
|
|
880
880
|
migrations_paths.first
|
881
881
|
end
|
882
882
|
|
883
|
+
def parse_migration_filename(filename) # :nodoc:
|
884
|
+
File.basename(filename).scan(/\A([0-9]+)_([_a-z0-9]*)\.?([_a-z0-9]*)?\.rb\z/).first
|
885
|
+
end
|
886
|
+
|
883
887
|
def migrations(paths)
|
884
888
|
paths = Array(paths)
|
885
889
|
|
886
|
-
|
887
|
-
|
888
|
-
migrations = files.map do |file|
|
889
|
-
version, name, scope = file.scan(/([0-9]+)_([_a-z0-9]*)\.?([_a-z0-9]*)?\.rb\z/).first
|
890
|
-
|
890
|
+
migrations = migration_files(paths).map do |file|
|
891
|
+
version, name, scope = parse_migration_filename(file)
|
891
892
|
raise IllegalMigrationNameError.new(file) unless version
|
892
893
|
version = version.to_i
|
893
894
|
name = name.camelize
|
@@ -898,6 +899,30 @@ module ActiveRecord
|
|
898
899
|
migrations.sort_by(&:version)
|
899
900
|
end
|
900
901
|
|
902
|
+
def migrations_status(paths)
|
903
|
+
paths = Array(paths)
|
904
|
+
|
905
|
+
db_list = ActiveRecord::SchemaMigration.normalized_versions
|
906
|
+
|
907
|
+
file_list = migration_files(paths).map do |file|
|
908
|
+
version, name, scope = parse_migration_filename(file)
|
909
|
+
raise IllegalMigrationNameError.new(file) unless version
|
910
|
+
version = ActiveRecord::SchemaMigration.normalize_migration_number(version)
|
911
|
+
status = db_list.delete(version) ? "up" : "down"
|
912
|
+
[status, version, (name + scope).humanize]
|
913
|
+
end.compact
|
914
|
+
|
915
|
+
db_list.map! do |version|
|
916
|
+
["up", version, "********** NO FILE **********"]
|
917
|
+
end
|
918
|
+
|
919
|
+
(db_list + file_list).sort_by { |_, version, _| version }
|
920
|
+
end
|
921
|
+
|
922
|
+
def migration_files(paths)
|
923
|
+
Dir[*paths.flat_map { |path| "#{path}/**/[0-9]*_*.rb" }]
|
924
|
+
end
|
925
|
+
|
901
926
|
private
|
902
927
|
|
903
928
|
def move(direction, migrations_paths, steps)
|
@@ -57,8 +57,10 @@ module ActiveRecord
|
|
57
57
|
console do |app|
|
58
58
|
require "active_record/railties/console_sandbox" if app.sandbox?
|
59
59
|
require "active_record/base"
|
60
|
-
|
61
|
-
|
60
|
+
unless ActiveSupport::Logger.logger_outputs_to?(Rails.logger, STDERR, STDOUT)
|
61
|
+
console = ActiveSupport::Logger.new(STDERR)
|
62
|
+
Rails.logger.extend ActiveSupport::Logger.broadcast console
|
63
|
+
end
|
62
64
|
end
|
63
65
|
|
64
66
|
runner do
|
@@ -63,6 +63,8 @@ db_namespace = namespace :db do
|
|
63
63
|
namespace :migrate do
|
64
64
|
# desc 'Rollbacks the database one migration and re migrate up (options: STEP=x, VERSION=x).'
|
65
65
|
task :redo => [:environment, :load_config] do
|
66
|
+
raise "Empty VERSION provided" if ENV["VERSION"] && ENV["VERSION"].empty?
|
67
|
+
|
66
68
|
if ENV['VERSION']
|
67
69
|
db_namespace['migrate:down'].invoke
|
68
70
|
db_namespace['migrate:up'].invoke
|
@@ -77,16 +79,17 @@ db_namespace = namespace :db do
|
|
77
79
|
|
78
80
|
# desc 'Runs the "up" for a given migration VERSION.'
|
79
81
|
task :up => [:environment, :load_config] do
|
82
|
+
raise "VERSION is required" if ENV["VERSION"] && ENV["VERSION"].empty?
|
83
|
+
|
80
84
|
version = ENV['VERSION'] ? ENV['VERSION'].to_i : nil
|
81
|
-
raise 'VERSION is required' unless version
|
82
85
|
ActiveRecord::Migrator.run(:up, ActiveRecord::Migrator.migrations_paths, version)
|
83
86
|
db_namespace['_dump'].invoke
|
84
87
|
end
|
85
88
|
|
86
89
|
# desc 'Runs the "down" for a given migration VERSION.'
|
87
90
|
task :down => [:environment, :load_config] do
|
91
|
+
raise "VERSION is required - To go down one migration, use db:rollback" if ENV["VERSION"] && ENV["VERSION"].empty?
|
88
92
|
version = ENV['VERSION'] ? ENV['VERSION'].to_i : nil
|
89
|
-
raise 'VERSION is required - To go down one migration, run db:rollback' unless version
|
90
93
|
ActiveRecord::Migrator.run(:down, ActiveRecord::Migrator.migrations_paths, version)
|
91
94
|
db_namespace['_dump'].invoke
|
92
95
|
end
|
@@ -96,26 +99,13 @@ db_namespace = namespace :db do
|
|
96
99
|
unless ActiveRecord::SchemaMigration.table_exists?
|
97
100
|
abort 'Schema migrations table does not exist yet.'
|
98
101
|
end
|
99
|
-
db_list = ActiveRecord::SchemaMigration.normalized_versions
|
100
|
-
|
101
|
-
file_list =
|
102
|
-
ActiveRecord::Migrator.migrations_paths.flat_map do |path|
|
103
|
-
# match "20091231235959_some_name.rb" and "001_some_name.rb" pattern
|
104
|
-
Dir.foreach(path).grep(/^(\d{3,})_(.+)\.rb$/) do
|
105
|
-
version = ActiveRecord::SchemaMigration.normalize_migration_number($1)
|
106
|
-
status = db_list.delete(version) ? 'up' : 'down'
|
107
|
-
[status, version, $2.humanize]
|
108
|
-
end
|
109
|
-
end
|
110
102
|
|
111
|
-
db_list.map! do |version|
|
112
|
-
['up', version, '********** NO FILE **********']
|
113
|
-
end
|
114
103
|
# output
|
115
104
|
puts "\ndatabase: #{ActiveRecord::Base.connection_config[:database]}\n\n"
|
116
105
|
puts "#{'Status'.center(8)} #{'Migration ID'.ljust(14)} Migration Name"
|
117
106
|
puts "-" * 50
|
118
|
-
|
107
|
+
paths = ActiveRecord::Tasks::DatabaseTasks.migrations_paths
|
108
|
+
ActiveRecord::Migrator.migrations_status(paths).each do |status, version, name|
|
119
109
|
puts "#{status.center(8)} #{version.ljust(14)} #{name}"
|
120
110
|
end
|
121
111
|
puts
|
@@ -310,7 +310,7 @@ module ActiveRecord
|
|
310
310
|
operation,
|
311
311
|
distinct).as(aggregate_alias)
|
312
312
|
]
|
313
|
-
select_values += select_values unless having_values.empty?
|
313
|
+
select_values += self.select_values unless having_values.empty?
|
314
314
|
|
315
315
|
select_values.concat group_fields.zip(group_aliases).map { |field,aliaz|
|
316
316
|
if field.respond_to?(:as)
|
@@ -130,6 +130,8 @@ module ActiveRecord
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def migrate
|
133
|
+
raise "Empty VERSION provided" if ENV["VERSION"] && ENV["VERSION"].empty?
|
134
|
+
|
133
135
|
verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
|
134
136
|
version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
|
135
137
|
scope = ENV['SCOPE']
|
@@ -17,8 +17,14 @@ module ActiveRecord
|
|
17
17
|
casted_value = case value
|
18
18
|
when ::Float
|
19
19
|
convert_float_to_big_decimal(value)
|
20
|
-
when ::Numeric
|
20
|
+
when ::Numeric
|
21
21
|
BigDecimal(value, precision.to_i)
|
22
|
+
when ::String
|
23
|
+
begin
|
24
|
+
value.to_d
|
25
|
+
rescue ArgumentError
|
26
|
+
BigDecimal(0)
|
27
|
+
end
|
22
28
|
else
|
23
29
|
if value.respond_to?(:to_d)
|
24
30
|
value.to_d
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.9.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.2.
|
19
|
+
version: 4.2.9.rc1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.2.
|
26
|
+
version: 4.2.9.rc1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activemodel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 4.2.
|
33
|
+
version: 4.2.9.rc1
|
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: 4.2.
|
40
|
+
version: 4.2.9.rc1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: arel
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -299,12 +299,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
299
299
|
version: 1.9.3
|
300
300
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
301
301
|
requirements:
|
302
|
-
- - "
|
302
|
+
- - ">"
|
303
303
|
- !ruby/object:Gem::Version
|
304
|
-
version:
|
304
|
+
version: 1.3.1
|
305
305
|
requirements: []
|
306
306
|
rubyforge_project:
|
307
|
-
rubygems_version: 2.6.
|
307
|
+
rubygems_version: 2.6.12
|
308
308
|
signing_key:
|
309
309
|
specification_version: 4
|
310
310
|
summary: Object-relational mapper framework (part of Rails).
|