migrant 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. data/.gitignore +24 -0
  2. data/LICENSE +20 -0
  3. data/README.rdoc +124 -0
  4. data/Rakefile +46 -0
  5. data/VERSION +1 -0
  6. data/lib/datatype/base.rb +65 -0
  7. data/lib/datatype/boolean.rb +15 -0
  8. data/lib/datatype/currency.rb +11 -0
  9. data/lib/datatype/date.rb +13 -0
  10. data/lib/datatype/float.rb +11 -0
  11. data/lib/datatype/foreign_key.rb +9 -0
  12. data/lib/datatype/hash.rb +10 -0
  13. data/lib/datatype/polymorphic.rb +8 -0
  14. data/lib/datatype/range.rb +13 -0
  15. data/lib/datatype/string.rb +22 -0
  16. data/lib/datatype/symbol.rb +10 -0
  17. data/lib/datatype/time.rb +5 -0
  18. data/lib/migrant/migration_generator.rb +123 -0
  19. data/lib/migrant/model_extensions.rb +37 -0
  20. data/lib/migrant/schema.rb +91 -0
  21. data/lib/migrant.rb +16 -0
  22. data/lib/railtie.rb +11 -0
  23. data/lib/tasks/db.rake +11 -0
  24. data/migrant.gemspec +167 -0
  25. data/test/additional_models/review.rb +10 -0
  26. data/test/helper.rb +38 -0
  27. data/test/rails_app/.gitignore +4 -0
  28. data/test/rails_app/README +256 -0
  29. data/test/rails_app/Rakefile +7 -0
  30. data/test/rails_app/app/controllers/application_controller.rb +3 -0
  31. data/test/rails_app/app/helpers/application_helper.rb +2 -0
  32. data/test/rails_app/app/models/business.rb +22 -0
  33. data/test/rails_app/app/models/business_category.rb +6 -0
  34. data/test/rails_app/app/models/category.rb +9 -0
  35. data/test/rails_app/app/models/customer.rb +7 -0
  36. data/test/rails_app/app/models/user.rb +8 -0
  37. data/test/rails_app/app/views/layouts/application.html.erb +14 -0
  38. data/test/rails_app/config/application.rb +16 -0
  39. data/test/rails_app/config/boot.rb +13 -0
  40. data/test/rails_app/config/database.yml +7 -0
  41. data/test/rails_app/config/environment.rb +5 -0
  42. data/test/rails_app/config/environments/development.rb +26 -0
  43. data/test/rails_app/config/environments/production.rb +49 -0
  44. data/test/rails_app/config/environments/test.rb +35 -0
  45. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  46. data/test/rails_app/config/initializers/inflections.rb +10 -0
  47. data/test/rails_app/config/initializers/mime_types.rb +5 -0
  48. data/test/rails_app/config/initializers/secret_token.rb +7 -0
  49. data/test/rails_app/config/initializers/session_store.rb +8 -0
  50. data/test/rails_app/config/locales/en.yml +5 -0
  51. data/test/rails_app/config/routes.rb +58 -0
  52. data/test/rails_app/config.ru +4 -0
  53. data/test/rails_app/db/schema.rb +82 -0
  54. data/test/rails_app/db/seeds.rb +7 -0
  55. data/test/rails_app/lib/tasks/.gitkeep +0 -0
  56. data/test/rails_app/public/404.html +26 -0
  57. data/test/rails_app/public/422.html +26 -0
  58. data/test/rails_app/public/500.html +26 -0
  59. data/test/rails_app/script/rails +6 -0
  60. data/test/rails_app/test/performance/browsing_test.rb +9 -0
  61. data/test/rails_app/test/test_helper.rb +13 -0
  62. data/test/rails_app/vendor/plugins/.gitkeep +0 -0
  63. data/test/test_data_schema.rb +85 -0
  64. data/test/test_migration_generator.rb +114 -0
  65. data/test/verified_output/migrations/business_id.rb +10 -0
  66. data/test/verified_output/migrations/create_business_categories.rb +14 -0
  67. data/test/verified_output/migrations/create_businesses.rb +28 -0
  68. data/test/verified_output/migrations/create_categories.rb +13 -0
  69. data/test/verified_output/migrations/create_reviews.rb +17 -0
  70. data/test/verified_output/migrations/create_users.rb +18 -0
  71. data/test/verified_output/migrations/estimated_value_notes.rb +11 -0
  72. data/test/verified_output/migrations/landline.rb +9 -0
  73. metadata +270 -0
@@ -0,0 +1,28 @@
1
+ class CreateBusinesses < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :businesses do |t|
4
+ t.integer :user_id
5
+ t.string :owner_type
6
+ t.integer :owner_id
7
+ t.string :name
8
+ t.string :website
9
+ t.text :address
10
+ t.string :summary
11
+ t.text :description
12
+ t.string :landline
13
+ t.string :mobile
14
+ t.integer :operating_days, :limit=>1
15
+ t.datetime :date_established
16
+ t.datetime :next_sale
17
+ t.boolean :verified
18
+ t.string :location, :limit=>127
19
+ end
20
+ add_index :businesses, :user_id
21
+ add_index :businesses, [:owner_type, :owner_id]
22
+ add_index :businesses, :owner_id
23
+ end
24
+
25
+ def self.down
26
+ drop_table :businesses
27
+ end
28
+ end
@@ -0,0 +1,13 @@
1
+ class CreateCategories < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :categories do |t|
4
+ t.string :title
5
+ t.string :summary
6
+ end
7
+ add_index :categories, :title
8
+ end
9
+
10
+ def self.down
11
+ drop_table :categories
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ class CreateReviews < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :reviews do |t|
4
+ t.integer :business_id
5
+ t.integer :user_id
6
+ t.string :name
7
+ t.integer :rating, :limit=>1
8
+ t.text :body
9
+ end
10
+ add_index :reviews, :business_id
11
+ add_index :reviews, :user_id
12
+ end
13
+
14
+ def self.down
15
+ drop_table :reviews
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :users do |t|
4
+ t.string :name
5
+ t.string :email
6
+ t.string :encrypted_password, :limit=>48
7
+ t.string :password_salt, :limit=>42
8
+ t.decimal :money_spent, :precision=>10, :scale=>2
9
+ t.decimal :money_gifted, :precision=>10, :scale=>2
10
+ t.float :average_rating
11
+ end
12
+
13
+ end
14
+
15
+ def self.down
16
+ drop_table :users
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ class BusinessesModifyFieldsEstimatedValueNotes < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :businesses, :estimated_value, :float
4
+ add_column :businesses, :notes, :string
5
+ end
6
+
7
+ def self.down
8
+ remove_column :businesses, :estimated_value
9
+ remove_column :businesses, :notes
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ class BusinessesModifyFieldsLandline < ActiveRecord::Migration
2
+ def self.up
3
+ change_column :businesses, :landline, :text
4
+ end
5
+
6
+ def self.down
7
+ change_column :businesses, :landline, :string, :limit=>255
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,270 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: migrant
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Pascal Houliston
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-10-28 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: thoughtbot-shoulda
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :development
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: ansi
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - "="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 2
44
+ - 2
45
+ version: 1.2.2
46
+ type: :development
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: turn
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - "="
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 0
58
+ - 8
59
+ - 1
60
+ version: 0.8.1
61
+ type: :development
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: sqlite3-ruby
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ type: :development
75
+ version_requirements: *id004
76
+ - !ruby/object:Gem::Dependency
77
+ name: simplecov
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ segments:
85
+ - 0
86
+ - 3
87
+ - 5
88
+ version: 0.3.5
89
+ type: :development
90
+ version_requirements: *id005
91
+ - !ruby/object:Gem::Dependency
92
+ name: activerecord
93
+ prerelease: false
94
+ requirement: &id006 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ segments:
100
+ - 3
101
+ - 0
102
+ - 0
103
+ version: 3.0.0
104
+ type: :runtime
105
+ version_requirements: *id006
106
+ - !ruby/object:Gem::Dependency
107
+ name: activesupport
108
+ prerelease: false
109
+ requirement: &id007 !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ segments:
115
+ - 3
116
+ - 0
117
+ - 0
118
+ version: 3.0.0
119
+ type: :runtime
120
+ version_requirements: *id007
121
+ description: Migrant gives you a super-clean DSL to describe your ActiveRecord models (somewhat similar to DataMapper) and generates all your migrations for you so you can spend more time coding the stuff that counts!
122
+ email: 101pascal@gmail.com
123
+ executables: []
124
+
125
+ extensions: []
126
+
127
+ extra_rdoc_files:
128
+ - LICENSE
129
+ - README.rdoc
130
+ files:
131
+ - .gitignore
132
+ - LICENSE
133
+ - README.rdoc
134
+ - Rakefile
135
+ - VERSION
136
+ - lib/datatype/base.rb
137
+ - lib/datatype/boolean.rb
138
+ - lib/datatype/currency.rb
139
+ - lib/datatype/date.rb
140
+ - lib/datatype/float.rb
141
+ - lib/datatype/foreign_key.rb
142
+ - lib/datatype/hash.rb
143
+ - lib/datatype/polymorphic.rb
144
+ - lib/datatype/range.rb
145
+ - lib/datatype/string.rb
146
+ - lib/datatype/symbol.rb
147
+ - lib/datatype/time.rb
148
+ - lib/migrant.rb
149
+ - lib/migrant/migration_generator.rb
150
+ - lib/migrant/model_extensions.rb
151
+ - lib/migrant/schema.rb
152
+ - lib/railtie.rb
153
+ - lib/tasks/db.rake
154
+ - migrant.gemspec
155
+ - test/additional_models/review.rb
156
+ - test/helper.rb
157
+ - test/rails_app/.gitignore
158
+ - test/rails_app/README
159
+ - test/rails_app/Rakefile
160
+ - test/rails_app/app/controllers/application_controller.rb
161
+ - test/rails_app/app/helpers/application_helper.rb
162
+ - test/rails_app/app/models/business.rb
163
+ - test/rails_app/app/models/business_category.rb
164
+ - test/rails_app/app/models/category.rb
165
+ - test/rails_app/app/models/customer.rb
166
+ - test/rails_app/app/models/user.rb
167
+ - test/rails_app/app/views/layouts/application.html.erb
168
+ - test/rails_app/config.ru
169
+ - test/rails_app/config/application.rb
170
+ - test/rails_app/config/boot.rb
171
+ - test/rails_app/config/database.yml
172
+ - test/rails_app/config/environment.rb
173
+ - test/rails_app/config/environments/development.rb
174
+ - test/rails_app/config/environments/production.rb
175
+ - test/rails_app/config/environments/test.rb
176
+ - test/rails_app/config/initializers/backtrace_silencers.rb
177
+ - test/rails_app/config/initializers/inflections.rb
178
+ - test/rails_app/config/initializers/mime_types.rb
179
+ - test/rails_app/config/initializers/secret_token.rb
180
+ - test/rails_app/config/initializers/session_store.rb
181
+ - test/rails_app/config/locales/en.yml
182
+ - test/rails_app/config/routes.rb
183
+ - test/rails_app/db/schema.rb
184
+ - test/rails_app/db/seeds.rb
185
+ - test/rails_app/lib/tasks/.gitkeep
186
+ - test/rails_app/public/404.html
187
+ - test/rails_app/public/422.html
188
+ - test/rails_app/public/500.html
189
+ - test/rails_app/script/rails
190
+ - test/rails_app/test/performance/browsing_test.rb
191
+ - test/rails_app/test/test_helper.rb
192
+ - test/rails_app/vendor/plugins/.gitkeep
193
+ - test/test_data_schema.rb
194
+ - test/test_migration_generator.rb
195
+ - test/verified_output/migrations/business_id.rb
196
+ - test/verified_output/migrations/create_business_categories.rb
197
+ - test/verified_output/migrations/create_businesses.rb
198
+ - test/verified_output/migrations/create_categories.rb
199
+ - test/verified_output/migrations/create_reviews.rb
200
+ - test/verified_output/migrations/create_users.rb
201
+ - test/verified_output/migrations/estimated_value_notes.rb
202
+ - test/verified_output/migrations/landline.rb
203
+ has_rdoc: true
204
+ homepage: http://github.com/pascalh1011/migrant
205
+ licenses: []
206
+
207
+ post_install_message:
208
+ rdoc_options:
209
+ - --charset=UTF-8
210
+ require_paths:
211
+ - lib
212
+ required_ruby_version: !ruby/object:Gem::Requirement
213
+ none: false
214
+ requirements:
215
+ - - ">="
216
+ - !ruby/object:Gem::Version
217
+ segments:
218
+ - 0
219
+ version: "0"
220
+ required_rubygems_version: !ruby/object:Gem::Requirement
221
+ none: false
222
+ requirements:
223
+ - - ">="
224
+ - !ruby/object:Gem::Version
225
+ segments:
226
+ - 0
227
+ version: "0"
228
+ requirements: []
229
+
230
+ rubyforge_project:
231
+ rubygems_version: 1.3.7
232
+ signing_key:
233
+ specification_version: 3
234
+ summary: All the fun of ActiveRecord, without writing your migrations, and a dash of mocking.
235
+ test_files:
236
+ - test/additional_models/review.rb
237
+ - test/test_migration_generator.rb
238
+ - test/rails_app/app/controllers/application_controller.rb
239
+ - test/rails_app/app/helpers/application_helper.rb
240
+ - test/rails_app/app/models/business.rb
241
+ - test/rails_app/app/models/user.rb
242
+ - test/rails_app/app/models/category.rb
243
+ - test/rails_app/app/models/business_category.rb
244
+ - test/rails_app/app/models/customer.rb
245
+ - test/rails_app/test/performance/browsing_test.rb
246
+ - test/rails_app/test/test_helper.rb
247
+ - test/rails_app/config/environments/development.rb
248
+ - test/rails_app/config/environments/test.rb
249
+ - test/rails_app/config/environments/production.rb
250
+ - test/rails_app/config/environment.rb
251
+ - test/rails_app/config/initializers/session_store.rb
252
+ - test/rails_app/config/initializers/inflections.rb
253
+ - test/rails_app/config/initializers/backtrace_silencers.rb
254
+ - test/rails_app/config/initializers/mime_types.rb
255
+ - test/rails_app/config/initializers/secret_token.rb
256
+ - test/rails_app/config/routes.rb
257
+ - test/rails_app/config/application.rb
258
+ - test/rails_app/config/boot.rb
259
+ - test/rails_app/db/schema.rb
260
+ - test/rails_app/db/seeds.rb
261
+ - test/verified_output/migrations/estimated_value_notes.rb
262
+ - test/verified_output/migrations/landline.rb
263
+ - test/verified_output/migrations/create_reviews.rb
264
+ - test/verified_output/migrations/create_businesses.rb
265
+ - test/verified_output/migrations/create_users.rb
266
+ - test/verified_output/migrations/create_business_categories.rb
267
+ - test/verified_output/migrations/create_categories.rb
268
+ - test/verified_output/migrations/business_id.rb
269
+ - test/helper.rb
270
+ - test/test_data_schema.rb