Permalink
Browse files

[padrino-gen] Updated column proprieties for DataMapper

  • Loading branch information...
1 parent f0d3632 commit 5f331f9643e52bdeff5e374b85b4fc38504d0c9b @DAddYE DAddYE committed Dec 21, 2010
View
@@ -15,7 +15,9 @@
* Removed mount_core
* Fix camelized model names in model generation
* Added slim renderer component
-* Now the content format can be set explicitly in a param [Thanks to qzio]
+* Now the content format can be set explicitly in a param [Thanks to Qzio]
+* Fixed I18n load_path [Thanks to Pirj]
+* Updated column proprieties for DataMapper
== 0.9.19
@@ -628,4 +628,4 @@ def route!(base=self.class, pass_block=nil)
end
end # InstanceMethods
end # Routing
-end # Padrino
+end # Padrino
@@ -82,7 +82,7 @@ def create_model_file(name, options={})
DM_MODEL_UP_MG = (<<-MIGRATION).gsub(/^/, ' ') unless defined?(DM_MODEL_UP_MG)
create_table :!TABLE! do
- column :id, DataMapper::Property::Integer, :serial => true
+ column :id, Integer, :serial => true
!FIELDS!
end
MIGRATION
@@ -93,7 +93,7 @@ def create_model_file(name, options={})
def create_model_migration(migration_name, name, columns)
output_model_migration(migration_name, name, columns,
- :column_format => Proc.new { |field, kind| "column :#{field}, DataMapper::Property::#{kind.classify}" },
+ :column_format => Proc.new { |field, kind| "column :#{field}, #{kind.classify}" },
:base => DM_MIGRATION, :up => DM_MODEL_UP_MG, :down => DM_MODEL_DOWN_MG)
end
@@ -106,7 +106,7 @@ def create_model_migration(migration_name, name, columns)
def create_migration_file(migration_name, name, columns)
output_migration_file(migration_name, name, columns,
:base => DM_MIGRATION, :change_format => DM_CHANGE_MG,
- :add => Proc.new { |field, kind| "add_column :#{field}, DataMapper::Property::#{kind.classify}" },
+ :add => Proc.new { |field, kind| "add_column :#{field}, #{kind.classify}" },
:remove => Proc.new { |field, kind| "drop_column :#{field}" }
)
end
@@ -107,8 +107,8 @@ def teardown
response_success = silence_logger { generate(:migration, *migration_params) }
migration_file_path = "#{@apptmp}/sample_project/db/migrate/001_add_email_to_users.rb"
assert_match_in_file(/migration\s1.*?:add_email_to_users/m, migration_file_path)
- assert_match_in_file(/modify_table :users.*?add_column :email, DataMapper::Property::String/m, migration_file_path)
- assert_match_in_file(/add_column :age, DataMapper::Property::Integer/m, migration_file_path)
+ assert_match_in_file(/modify_table :users.*?add_column :email, String/m, migration_file_path)
+ assert_match_in_file(/add_column :age, Integer/m, migration_file_path)
assert_match_in_file(/modify_table :users.*?drop_column :email/m, migration_file_path)
assert_match_in_file(/drop_column :age/m, migration_file_path)
end
@@ -121,8 +121,8 @@ def teardown
assert_match_in_file(/migration\s1.*?:remove_email_from_users/m, migration_file_path)
assert_match_in_file(/modify_table :users.*?drop_column :email/m, migration_file_path)
assert_match_in_file(/drop_column :age/m, migration_file_path)
- assert_match_in_file(/modify_table :users.*?add_column :email, DataMapper::Property::String/m, migration_file_path)
- assert_match_in_file(/add_column :age, DataMapper::Property::Integer/m, migration_file_path)
+ assert_match_in_file(/modify_table :users.*?add_column :email, String/m, migration_file_path)
+ assert_match_in_file(/add_column :age, Integer/m, migration_file_path)
end
should "properly version migration files" do
@@ -184,9 +184,9 @@ def teardown
migration_file_path = "#{@apptmp}/sample_project/db/migrate/001_create_people.rb"
assert_match_in_file(/migration 1, :create_people do/m, migration_file_path)
assert_match_in_file(/create_table :people do/m, migration_file_path)
- assert_match_in_file(/column :name, DataMapper::Property::String/m, migration_file_path)
- assert_match_in_file(/column :created_at, DataMapper::Property::DateTime/m, migration_file_path)
- assert_match_in_file(/column :email, DataMapper::Property::String/m, migration_file_path)
+ assert_match_in_file(/column :name, String/m, migration_file_path)
+ assert_match_in_file(/column :created_at, DateTime/m, migration_file_path)
+ assert_match_in_file(/column :email, String/m, migration_file_path)
assert_match_in_file(/drop_table :people/m, migration_file_path)
end
end

0 comments on commit 5f331f9

Please sign in to comment.