Skip to content

Commit

Permalink
Use CURRENT_TIMESTAMP since it has apparently better cross db support
Browse files Browse the repository at this point in the history
LOCALTIMESTAMP is not support by sqlite3, and travis was giving us these
errors: https://travis-ci.org/rails/rails/jobs/3535241/#L570
  • Loading branch information
carlosantoniodasilva committed Dec 7, 2012
1 parent 43c2842 commit 0029244
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -490,7 +490,7 @@ def dump_schema_information #:nodoc:
sm_table = ActiveRecord::Migrator.schema_migrations_table_name

ActiveRecord::SchemaMigration.order('version').map { |sm|
"INSERT INTO #{sm_table} (version, migrated_at, fingerprint, name) VALUES ('#{sm.version}',LOCALTIMESTAMP,'#{sm.fingerprint}','#{sm.name}');"
"INSERT INTO #{sm_table} (version, migrated_at, fingerprint, name) VALUES ('#{sm.version}',CURRENT_TIMESTAMP,'#{sm.fingerprint}','#{sm.name}');"
}.join("\n\n")
end

Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/cases/schema_dumper_test.rb
Expand Up @@ -24,7 +24,7 @@ def test_dump_schema_information_outputs_lexically_ordered_versions

schema_info = ActiveRecord::Base.connection.dump_schema_information
assert_match(/20100201010101.*20100301010101/m, schema_info)
target_line = %q{INSERT INTO schema_migrations (version, migrated_at, fingerprint, name) VALUES ('20100101010101',LOCALTIMESTAMP,'123456789012345678901234567890ab','anon');}
target_line = %q{INSERT INTO schema_migrations (version, migrated_at, fingerprint, name) VALUES ('20100101010101',CURRENT_TIMESTAMP,'123456789012345678901234567890ab','anon');}
assert_match target_line, schema_info
end

Expand Down

3 comments on commit 0029244

@carlosantoniodasilva
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @joshsusser let me know if you have any comment / concern about this.

@joshsusser
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think CURRENT_TIMESTAMP is fine.

@carlosantoniodasilva
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshsusser ok, thanks.

Please sign in to comment.