diff options
author | Josh Susser <josh@hasmanythrough.com> | 2010-03-20 18:26:12 -0700 |
---|---|---|
committer | Josh Susser <josh@hasmanythrough.com> | 2010-12-01 10:57:38 -0800 |
commit | 7139aa878ceea8dd17a60955cd4d07f5f68980d9 (patch) | |
tree | 6246048e1a611d770a3f5b5b0208c6597cbd646a /activerecord/lib/active_record/schema.rb | |
parent | 4e4e9ad48a222ac94a904c62ae684c609bd8e177 (diff) | |
download | rails-7139aa878ceea8dd17a60955cd4d07f5f68980d9.tar.gz rails-7139aa878ceea8dd17a60955cd4d07f5f68980d9.tar.bz2 rails-7139aa878ceea8dd17a60955cd4d07f5f68980d9.zip |
name in schema_migrations, migrations in schema dump
Diffstat (limited to 'activerecord/lib/active_record/schema.rb')
-rw-r--r-- | activerecord/lib/active_record/schema.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/schema.rb b/activerecord/lib/active_record/schema.rb index c6bb5c1961..c9b5539e4f 100644 --- a/activerecord/lib/active_record/schema.rb +++ b/activerecord/lib/active_record/schema.rb @@ -49,10 +49,19 @@ module ActiveRecord schema = new schema.instance_eval(&block) - unless info[:version].blank? - initialize_schema_migrations_table - assume_migrated_upto_version(info[:version], schema.migrations_path) - end + initialize_schema_migrations_table + assume_migrated_upto_version(info[:version], schema.migrations_path) unless info[:version].blank? + end + + def self.migration(version, name="", options={}) + name, options = "", name if name.is_a?(Hash) + + table = Arel::Table.new(ActiveRecord::Migrator.schema_migrations_table_name) + table.insert( + table["version"] => version, + table["name"] => name, + table["migrated_at"] => Time.now + ) end end end |