diff options
author | Anton Chuchkalov <a2new@yandex.ru> | 2017-04-05 22:19:05 +0300 |
---|---|---|
committer | Anton Chuchkalov <a2new@yandex.ru> | 2017-04-05 22:19:05 +0300 |
commit | 826e49cfbe9589e600e652c31eb62954dcc86061 (patch) | |
tree | 0fa26a33ca4d9771cf30c0f338cd4589bb6cceb0 /activerecord/lib/active_record | |
parent | 70514d3bd12259c3f4cabc7589865a3b5a54ed28 (diff) | |
download | rails-826e49cfbe9589e600e652c31eb62954dcc86061.tar.gz rails-826e49cfbe9589e600e652c31eb62954dcc86061.tar.bz2 rails-826e49cfbe9589e600e652c31eb62954dcc86061.zip |
use formatted number as schema version
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/schema_dumper.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index 2bbfd01698..657bd43b86 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -47,8 +47,16 @@ module ActiveRecord @options = options end + # turns 20170404131909 into "2017_04_04131909" + def formatted_version + return "" unless @version + stringified = @version.to_s + return stringified unless stringified.length == 14 + stringified.insert(4, "_").insert(7, "_").insert(10, "_") + end + def header(stream) - define_params = @version ? "version: #{@version}" : "" + define_params = @version ? "version: #{formatted_version}" : "" stream.puts <<HEADER # This file is auto-generated from the current state of the database. Instead |