migraine 0.0.1
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.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.md +264 -0
- data/Rakefile +7 -0
- data/examples/generated.rb +571 -0
- data/examples/generation.rb +9 -0
- data/examples/migration.rb +15 -0
- data/lib/migraine.rb +5 -0
- data/lib/migraine/generator.rb +103 -0
- data/lib/migraine/map.rb +85 -0
- data/lib/migraine/migration.rb +108 -0
- data/lib/migraine/version.rb +3 -0
- data/migraine.gemspec +23 -0
- data/spec/map_spec.rb +55 -0
- data/spec/migration_spec.rb +64 -0
- data/spec/spec_helper.rb +27 -0
- metadata +87 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,264 @@
|
|
1
|
+
# Migraine Ruby Gem
|
2
|
+
|
3
|
+
## Introduction
|
4
|
+
|
5
|
+
Have you ever felt enthusiastic about migrating data from one
|
6
|
+
database to another? Me neither. Migraine is a simple gem to
|
7
|
+
assist in writing data migration scripts in Ruby. It supports
|
8
|
+
various database adapters (e.g. MySQL, SQLite3, PostgreSQL)
|
9
|
+
through its only dependency, the
|
10
|
+
[Sequel](https://github.com/jeremyevans/sequel) Ruby gem.
|
11
|
+
|
12
|
+
## Requirements
|
13
|
+
|
14
|
+
* Ruby 1.9
|
15
|
+
* [Sequel](https://github.com/jeremyevans/sequel)
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
myproject.com
|
20
|
+
> gem install migraine
|
21
|
+
|
22
|
+
## Todo
|
23
|
+
|
24
|
+
1. `Migraine::Map#map` (or separate method) should be able to deal
|
25
|
+
with column type differences between source and destination. The
|
26
|
+
method should accept a block argument that takes source record
|
27
|
+
as input, and relies on developer to manipulate that and
|
28
|
+
return valid destination data.
|
29
|
+
|
30
|
+
migration.map 'table' do
|
31
|
+
map 'column' => 'new_column' do |source|
|
32
|
+
destination = "A new string from #{source}"
|
33
|
+
destination.upcase
|
34
|
+
|
35
|
+
destination
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
2. Provide further adapter support for schema generator, and thus
|
40
|
+
migration file generation. As of now, migration files can only
|
41
|
+
be generated for MySQL databases since different databases
|
42
|
+
require different ways of generating a schema (which is used
|
43
|
+
for analyzing difference between source and destination.)
|
44
|
+
|
45
|
+
See `lib/migraine/generator.rb` for further details.
|
46
|
+
|
47
|
+
## Using Migraine
|
48
|
+
|
49
|
+
### Create migration file
|
50
|
+
|
51
|
+
myproject.com
|
52
|
+
> vim migrate.rb
|
53
|
+
|
54
|
+
### The migration file
|
55
|
+
|
56
|
+
You must now tell Migraine what data you want to migrate, and
|
57
|
+
where. But first require the Migraine gem.
|
58
|
+
|
59
|
+
require 'migraine'
|
60
|
+
|
61
|
+
Create a migration, specifying source and destination databases.
|
62
|
+
For information about how to write the connection URI's, see the
|
63
|
+
documentation of [Sequel](https://github.com/jeremyevans/sequel).
|
64
|
+
It's very simple, I promise.
|
65
|
+
|
66
|
+
migration = Migraine::Migration.new(
|
67
|
+
from: "mysql://root:root@localhost/myproj_old",
|
68
|
+
to: "mysql://root:root@localhost/myproj"
|
69
|
+
)
|
70
|
+
|
71
|
+
Map source tables to destination tables. If the columns are
|
72
|
+
unchanged in the destination table, you do not need to provide
|
73
|
+
any block with instructions. Simply map source table to
|
74
|
+
destination table.
|
75
|
+
|
76
|
+
migration.map "products" => "spree_products"
|
77
|
+
|
78
|
+
If source and destination tables have the same name in both
|
79
|
+
databases, you can make it even shorter.
|
80
|
+
|
81
|
+
migration.map "products"
|
82
|
+
|
83
|
+
On the other hand, if the column names have changed at the
|
84
|
+
destination, you can provide instructions on how to map them.
|
85
|
+
|
86
|
+
migration.map "users" => "spree_users" do
|
87
|
+
map "crypted_password" => "encrypted_password"
|
88
|
+
map "salt" => "password_salt"
|
89
|
+
|
90
|
+
map "remember_token"
|
91
|
+
map "persistance_token"
|
92
|
+
map "perishable_token"
|
93
|
+
end
|
94
|
+
|
95
|
+
**TODO:** In the future, Migraine will provide methods for dealing
|
96
|
+
with differences in column types. See Todo section above.
|
97
|
+
|
98
|
+
When you have provided the mappings, tell Migraine that you want
|
99
|
+
to run the migration.
|
100
|
+
|
101
|
+
migration.run
|
102
|
+
|
103
|
+
### Run migration file
|
104
|
+
|
105
|
+
myproject.com
|
106
|
+
> ruby migrate.rb
|
107
|
+
|
108
|
+
## Generating migration files
|
109
|
+
|
110
|
+
Migraine can even generate migration files for you. This is
|
111
|
+
useful for databases with many tables, where you don't want to
|
112
|
+
type them all out manually.
|
113
|
+
|
114
|
+
### Adapter support
|
115
|
+
|
116
|
+
At the moment, Migraine can only generate migrations
|
117
|
+
for MySQL databases. This is because to analyze the differences
|
118
|
+
between source and destination, we need to generate database
|
119
|
+
schemas as Hashes. Right now there is only a method for MySQL.
|
120
|
+
|
121
|
+
Please feel free to add methods for other adapters as well. You
|
122
|
+
can do this by forking Migraine, editing
|
123
|
+
`lib/migraine/generator.rb` and add a new method. The file
|
124
|
+
is commented with further instructions.
|
125
|
+
|
126
|
+
### Create generation file
|
127
|
+
|
128
|
+
You will need to create a file with generation instructions, just
|
129
|
+
like you create a file for migrations.
|
130
|
+
|
131
|
+
myproject.com
|
132
|
+
> vim generate.rb
|
133
|
+
|
134
|
+
### The generation file
|
135
|
+
|
136
|
+
All you need to do in your new Ruby file is to create a
|
137
|
+
`Migraine::Migration` with a source and destination, and tell
|
138
|
+
Migraine to generate a migration file for it.
|
139
|
+
|
140
|
+
migration = Migraine::Migration.new(
|
141
|
+
from: "mysql://root:root@localhost/myproj_old",
|
142
|
+
to: "mysql://root:root@localhost/myproj"
|
143
|
+
)
|
144
|
+
|
145
|
+
migration.generate 'migrate.rb'
|
146
|
+
|
147
|
+
When you run this file using `ruby generate.rb` or similar, it
|
148
|
+
will create a migrate.rb file containing table and column
|
149
|
+
mappings.
|
150
|
+
|
151
|
+
Migraine will try to determine the mappings by analyzing the
|
152
|
+
differences between source and destination. When it can't, it
|
153
|
+
will simply leave the destinations empty for you to fill in.
|
154
|
+
|
155
|
+
### Table prefixes
|
156
|
+
|
157
|
+
If the destination database has many of the same tables as
|
158
|
+
source, but with an added prefix (e.g. source table 'users'
|
159
|
+
should be mapped to destination table 'spree_users'), you can use
|
160
|
+
the prefix method to tell Migraine about it and, and it will
|
161
|
+
consider that when looking for destination tables.
|
162
|
+
|
163
|
+
Add the following before your call to `Migration#generate`.
|
164
|
+
|
165
|
+
migration.prefix 'spree_'
|
166
|
+
|
167
|
+
### Example
|
168
|
+
|
169
|
+
Following is a generation file and part of its resulting
|
170
|
+
migration file (abbreviated since Spree has many tables.)
|
171
|
+
|
172
|
+
#### generate.rb
|
173
|
+
|
174
|
+
require 'migraine'
|
175
|
+
|
176
|
+
migration = Migraine::Migration.new(
|
177
|
+
from: 'mysql://root:root@localhost/migraine_from',
|
178
|
+
to: 'mysql://root:root@localhost/migraine_to'
|
179
|
+
)
|
180
|
+
|
181
|
+
migration.prefix 'spree_'
|
182
|
+
|
183
|
+
migration.generate 'generated.rb'
|
184
|
+
|
185
|
+
After running `ruby generate.rb`, Migraine will generate the
|
186
|
+
following file.
|
187
|
+
|
188
|
+
#### generated.rb
|
189
|
+
|
190
|
+
require 'migraine'
|
191
|
+
|
192
|
+
migration = Migraine::Migration.new(
|
193
|
+
from: 'mysql://root:root@localhost/migraine_from',
|
194
|
+
to: 'mysql://root:root@localhost/migraine_to'
|
195
|
+
)
|
196
|
+
|
197
|
+
migration.map 'addresses' => 'spree_addresses'
|
198
|
+
map 'id'
|
199
|
+
map 'firstname'
|
200
|
+
map 'lastname'
|
201
|
+
map 'address1'
|
202
|
+
map 'address2'
|
203
|
+
map 'city'
|
204
|
+
map 'state_id'
|
205
|
+
map 'zipcode'
|
206
|
+
map 'country_id'
|
207
|
+
map 'phone'
|
208
|
+
map 'created_at'
|
209
|
+
map 'updated_at'
|
210
|
+
map 'state_name'
|
211
|
+
map 'alternative_phone'
|
212
|
+
end
|
213
|
+
|
214
|
+
migration.map 'adjustments' => 'spree_adjustments'
|
215
|
+
map 'id'
|
216
|
+
map 'order_id' => ''
|
217
|
+
map 'type' => ''
|
218
|
+
map 'amount'
|
219
|
+
map 'description' => ''
|
220
|
+
map 'position' => ''
|
221
|
+
map 'created_at'
|
222
|
+
map 'updated_at'
|
223
|
+
map 'adjustment_source_id' => ''
|
224
|
+
map 'adjustment_source_type' => ''
|
225
|
+
end
|
226
|
+
|
227
|
+
migration.map 'assets' => 'spree_assets'
|
228
|
+
map 'id'
|
229
|
+
map 'viewable_id'
|
230
|
+
map 'viewable_type'
|
231
|
+
map 'attachment_content_type'
|
232
|
+
map 'attachment_file_name'
|
233
|
+
map 'attachment_size'
|
234
|
+
map 'position'
|
235
|
+
map 'type'
|
236
|
+
map 'attachment_updated_at'
|
237
|
+
map 'attachment_width'
|
238
|
+
map 'attachment_height'
|
239
|
+
map 'alt'
|
240
|
+
end
|
241
|
+
|
242
|
+
migration.map 'calculators' => 'spree_calculators'
|
243
|
+
map 'id'
|
244
|
+
map 'type'
|
245
|
+
map 'calculable_id'
|
246
|
+
map 'calculable_type'
|
247
|
+
map 'created_at'
|
248
|
+
map 'updated_at'
|
249
|
+
end
|
250
|
+
|
251
|
+
migration.map 'checkouts' => ''
|
252
|
+
map 'id' => ''
|
253
|
+
map 'order_id' => ''
|
254
|
+
map 'email' => ''
|
255
|
+
map 'ip_address' => ''
|
256
|
+
map 'special_instructions' => ''
|
257
|
+
map 'bill_address_id' => ''
|
258
|
+
map 'created_at' => ''
|
259
|
+
map 'updated_at' => ''
|
260
|
+
map 'state' => ''
|
261
|
+
map 'ship_address_id' => ''
|
262
|
+
map 'shipping_method_id' => ''
|
263
|
+
end
|
264
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,571 @@
|
|
1
|
+
require 'migraine'
|
2
|
+
|
3
|
+
migration = Migraine::Migration.new(
|
4
|
+
from: 'mysql://root:root@localhost/migraine_from',
|
5
|
+
to: 'mysql://root:root@localhost/migraine_to'
|
6
|
+
)
|
7
|
+
|
8
|
+
migration.map 'addresses' => 'spree_addresses'
|
9
|
+
map 'id'
|
10
|
+
map 'firstname'
|
11
|
+
map 'lastname'
|
12
|
+
map 'address1'
|
13
|
+
map 'address2'
|
14
|
+
map 'city'
|
15
|
+
map 'state_id'
|
16
|
+
map 'zipcode'
|
17
|
+
map 'country_id'
|
18
|
+
map 'phone'
|
19
|
+
map 'created_at'
|
20
|
+
map 'updated_at'
|
21
|
+
map 'state_name'
|
22
|
+
map 'alternative_phone'
|
23
|
+
end
|
24
|
+
|
25
|
+
migration.map 'adjustments' => 'spree_adjustments'
|
26
|
+
map 'id'
|
27
|
+
map 'order_id' => ''
|
28
|
+
map 'type' => ''
|
29
|
+
map 'amount'
|
30
|
+
map 'description' => ''
|
31
|
+
map 'position' => ''
|
32
|
+
map 'created_at'
|
33
|
+
map 'updated_at'
|
34
|
+
map 'adjustment_source_id' => ''
|
35
|
+
map 'adjustment_source_type' => ''
|
36
|
+
end
|
37
|
+
|
38
|
+
migration.map 'assets' => 'spree_assets'
|
39
|
+
map 'id'
|
40
|
+
map 'viewable_id'
|
41
|
+
map 'viewable_type'
|
42
|
+
map 'attachment_content_type'
|
43
|
+
map 'attachment_file_name'
|
44
|
+
map 'attachment_size'
|
45
|
+
map 'position'
|
46
|
+
map 'type'
|
47
|
+
map 'attachment_updated_at'
|
48
|
+
map 'attachment_width'
|
49
|
+
map 'attachment_height'
|
50
|
+
map 'alt'
|
51
|
+
end
|
52
|
+
|
53
|
+
migration.map 'calculators' => 'spree_calculators'
|
54
|
+
map 'id'
|
55
|
+
map 'type'
|
56
|
+
map 'calculable_id'
|
57
|
+
map 'calculable_type'
|
58
|
+
map 'created_at'
|
59
|
+
map 'updated_at'
|
60
|
+
end
|
61
|
+
|
62
|
+
migration.map 'checkouts' => ''
|
63
|
+
map 'id' => ''
|
64
|
+
map 'order_id' => ''
|
65
|
+
map 'email' => ''
|
66
|
+
map 'ip_address' => ''
|
67
|
+
map 'special_instructions' => ''
|
68
|
+
map 'bill_address_id' => ''
|
69
|
+
map 'created_at' => ''
|
70
|
+
map 'updated_at' => ''
|
71
|
+
map 'state' => ''
|
72
|
+
map 'ship_address_id' => ''
|
73
|
+
map 'shipping_method_id' => ''
|
74
|
+
end
|
75
|
+
|
76
|
+
migration.map 'configurations' => 'spree_configurations'
|
77
|
+
map 'id'
|
78
|
+
map 'name'
|
79
|
+
map 'created_at'
|
80
|
+
map 'updated_at'
|
81
|
+
map 'type'
|
82
|
+
end
|
83
|
+
|
84
|
+
migration.map 'countries' => 'spree_countries'
|
85
|
+
map 'id'
|
86
|
+
map 'iso_name'
|
87
|
+
map 'iso'
|
88
|
+
map 'name'
|
89
|
+
map 'iso3'
|
90
|
+
map 'numcode'
|
91
|
+
end
|
92
|
+
|
93
|
+
migration.map 'coupons' => ''
|
94
|
+
map 'id' => ''
|
95
|
+
map 'code' => ''
|
96
|
+
map 'description' => ''
|
97
|
+
map 'usage_limit' => ''
|
98
|
+
map 'combine' => ''
|
99
|
+
map 'expires_at' => ''
|
100
|
+
map 'created_at' => ''
|
101
|
+
map 'updated_at' => ''
|
102
|
+
map 'starts_at' => ''
|
103
|
+
end
|
104
|
+
|
105
|
+
migration.map 'creditcards' => 'spree_creditcards'
|
106
|
+
map 'id'
|
107
|
+
map 'number' => ''
|
108
|
+
map 'month'
|
109
|
+
map 'year'
|
110
|
+
map 'verification_value' => ''
|
111
|
+
map 'cc_type'
|
112
|
+
map 'last_digits'
|
113
|
+
map 'first_name'
|
114
|
+
map 'last_name'
|
115
|
+
map 'created_at'
|
116
|
+
map 'updated_at'
|
117
|
+
map 'start_month'
|
118
|
+
map 'start_year'
|
119
|
+
map 'issue_number'
|
120
|
+
map 'address_id'
|
121
|
+
map 'gateway_customer_profile_id'
|
122
|
+
map 'gateway_payment_profile_id'
|
123
|
+
end
|
124
|
+
|
125
|
+
migration.map 'gateways' => 'spree_gateways'
|
126
|
+
map 'id'
|
127
|
+
map 'type'
|
128
|
+
map 'name'
|
129
|
+
map 'description'
|
130
|
+
map 'active'
|
131
|
+
map 'environment'
|
132
|
+
map 'server'
|
133
|
+
map 'test_mode'
|
134
|
+
map 'created_at'
|
135
|
+
map 'updated_at'
|
136
|
+
end
|
137
|
+
|
138
|
+
migration.map 'inventory_units' => 'spree_inventory_units'
|
139
|
+
map 'id'
|
140
|
+
map 'variant_id'
|
141
|
+
map 'order_id'
|
142
|
+
map 'state'
|
143
|
+
map 'lock_version'
|
144
|
+
map 'created_at'
|
145
|
+
map 'updated_at'
|
146
|
+
map 'shipment_id'
|
147
|
+
map 'return_authorization_id'
|
148
|
+
end
|
149
|
+
|
150
|
+
migration.map 'line_items' => 'spree_line_items'
|
151
|
+
map 'id'
|
152
|
+
map 'order_id'
|
153
|
+
map 'variant_id'
|
154
|
+
map 'quantity'
|
155
|
+
map 'price'
|
156
|
+
map 'created_at'
|
157
|
+
map 'updated_at'
|
158
|
+
end
|
159
|
+
|
160
|
+
migration.map 'open_id_authentication_associations' => ''
|
161
|
+
map 'id' => ''
|
162
|
+
map 'issued' => ''
|
163
|
+
map 'lifetime' => ''
|
164
|
+
map 'handle' => ''
|
165
|
+
map 'assoc_type' => ''
|
166
|
+
map 'server_url' => ''
|
167
|
+
map 'secret' => ''
|
168
|
+
end
|
169
|
+
|
170
|
+
migration.map 'open_id_authentication_nonces' => ''
|
171
|
+
map 'id' => ''
|
172
|
+
map 'timestamp' => ''
|
173
|
+
map 'server_url' => ''
|
174
|
+
map 'salt' => ''
|
175
|
+
end
|
176
|
+
|
177
|
+
migration.map 'option_types' => 'spree_option_types'
|
178
|
+
map 'id'
|
179
|
+
map 'name'
|
180
|
+
map 'presentation'
|
181
|
+
map 'created_at'
|
182
|
+
map 'updated_at'
|
183
|
+
end
|
184
|
+
|
185
|
+
migration.map 'option_types_prototypes' => 'spree_option_types_prototypes'
|
186
|
+
map 'prototype_id'
|
187
|
+
map 'option_type_id'
|
188
|
+
end
|
189
|
+
|
190
|
+
migration.map 'option_values' => 'spree_option_values'
|
191
|
+
map 'id'
|
192
|
+
map 'option_type_id'
|
193
|
+
map 'name'
|
194
|
+
map 'position'
|
195
|
+
map 'presentation'
|
196
|
+
map 'created_at'
|
197
|
+
map 'updated_at'
|
198
|
+
end
|
199
|
+
|
200
|
+
migration.map 'option_values_variants' => 'spree_option_values_variants'
|
201
|
+
map 'variant_id'
|
202
|
+
map 'option_value_id'
|
203
|
+
end
|
204
|
+
|
205
|
+
migration.map 'orders' => 'spree_orders'
|
206
|
+
map 'id'
|
207
|
+
map 'user_id'
|
208
|
+
map 'number'
|
209
|
+
map 'item_total'
|
210
|
+
map 'total'
|
211
|
+
map 'created_at'
|
212
|
+
map 'updated_at'
|
213
|
+
map 'state'
|
214
|
+
map 'token' => ''
|
215
|
+
map 'adjustment_total'
|
216
|
+
map 'credit_total'
|
217
|
+
map 'completed_at'
|
218
|
+
end
|
219
|
+
|
220
|
+
migration.map 'pages' => ''
|
221
|
+
map 'id' => ''
|
222
|
+
map 'title' => ''
|
223
|
+
map 'body' => ''
|
224
|
+
map 'slug' => ''
|
225
|
+
map 'created_at' => ''
|
226
|
+
map 'updated_at' => ''
|
227
|
+
map 'show_in_header' => ''
|
228
|
+
map 'show_in_footer' => ''
|
229
|
+
map 'foreign_link' => ''
|
230
|
+
map 'position' => ''
|
231
|
+
map 'visible' => ''
|
232
|
+
map 'meta_keywords' => ''
|
233
|
+
map 'meta_description' => ''
|
234
|
+
map 'layout' => ''
|
235
|
+
map 'show_in_sidebar' => ''
|
236
|
+
end
|
237
|
+
|
238
|
+
migration.map 'payment_methods' => 'spree_payment_methods'
|
239
|
+
map 'id'
|
240
|
+
map 'type'
|
241
|
+
map 'name'
|
242
|
+
map 'description'
|
243
|
+
map 'active'
|
244
|
+
map 'environment'
|
245
|
+
map 'created_at'
|
246
|
+
map 'updated_at'
|
247
|
+
map 'deleted_at'
|
248
|
+
map 'display' => ''
|
249
|
+
end
|
250
|
+
|
251
|
+
migration.map 'payments' => 'spree_payments'
|
252
|
+
map 'id'
|
253
|
+
map 'payable_id' => ''
|
254
|
+
map 'created_at'
|
255
|
+
map 'updated_at'
|
256
|
+
map 'amount'
|
257
|
+
map 'payable_type' => ''
|
258
|
+
map 'source_id'
|
259
|
+
map 'source_type'
|
260
|
+
map 'payment_method_id'
|
261
|
+
end
|
262
|
+
|
263
|
+
migration.map 'preferences' => 'spree_preferences'
|
264
|
+
map 'id'
|
265
|
+
map 'attribute' => ''
|
266
|
+
map 'owner_id' => ''
|
267
|
+
map 'owner_type' => ''
|
268
|
+
map 'group_id' => ''
|
269
|
+
map 'group_type' => ''
|
270
|
+
map 'value'
|
271
|
+
map 'created_at'
|
272
|
+
map 'updated_at'
|
273
|
+
end
|
274
|
+
|
275
|
+
migration.map 'product_groups' => 'spree_product_groups'
|
276
|
+
map 'id'
|
277
|
+
map 'name'
|
278
|
+
map 'permalink'
|
279
|
+
map 'order'
|
280
|
+
end
|
281
|
+
|
282
|
+
migration.map 'product_groups_products' => 'spree_product_groups_products'
|
283
|
+
map 'product_id'
|
284
|
+
map 'product_group_id'
|
285
|
+
end
|
286
|
+
|
287
|
+
migration.map 'product_option_types' => 'spree_product_option_types'
|
288
|
+
map 'id'
|
289
|
+
map 'product_id'
|
290
|
+
map 'option_type_id'
|
291
|
+
map 'position'
|
292
|
+
map 'created_at'
|
293
|
+
map 'updated_at'
|
294
|
+
end
|
295
|
+
|
296
|
+
migration.map 'product_properties' => 'spree_product_properties'
|
297
|
+
map 'id'
|
298
|
+
map 'product_id'
|
299
|
+
map 'property_id'
|
300
|
+
map 'value'
|
301
|
+
map 'created_at'
|
302
|
+
map 'updated_at'
|
303
|
+
end
|
304
|
+
|
305
|
+
migration.map 'product_scopes' => 'spree_product_scopes'
|
306
|
+
map 'id'
|
307
|
+
map 'product_group_id'
|
308
|
+
map 'name'
|
309
|
+
map 'arguments'
|
310
|
+
end
|
311
|
+
|
312
|
+
migration.map 'products' => 'spree_products'
|
313
|
+
map 'id'
|
314
|
+
map 'name'
|
315
|
+
map 'description'
|
316
|
+
map 'created_at'
|
317
|
+
map 'updated_at'
|
318
|
+
map 'permalink'
|
319
|
+
map 'available_on'
|
320
|
+
map 'tax_category_id'
|
321
|
+
map 'shipping_category_id'
|
322
|
+
map 'deleted_at'
|
323
|
+
map 'meta_description'
|
324
|
+
map 'meta_keywords'
|
325
|
+
map 'count_on_hand'
|
326
|
+
end
|
327
|
+
|
328
|
+
migration.map 'products_taxons' => 'spree_products_taxons'
|
329
|
+
map 'product_id'
|
330
|
+
map 'taxon_id'
|
331
|
+
end
|
332
|
+
|
333
|
+
migration.map 'properties' => 'spree_properties'
|
334
|
+
map 'id'
|
335
|
+
map 'name'
|
336
|
+
map 'presentation'
|
337
|
+
map 'created_at'
|
338
|
+
map 'updated_at'
|
339
|
+
end
|
340
|
+
|
341
|
+
migration.map 'properties_prototypes' => 'spree_properties_prototypes'
|
342
|
+
map 'prototype_id'
|
343
|
+
map 'property_id'
|
344
|
+
end
|
345
|
+
|
346
|
+
migration.map 'prototypes' => 'spree_prototypes'
|
347
|
+
map 'id'
|
348
|
+
map 'name'
|
349
|
+
map 'created_at'
|
350
|
+
map 'updated_at'
|
351
|
+
end
|
352
|
+
|
353
|
+
migration.map 'queued_mails' => ''
|
354
|
+
map 'id' => ''
|
355
|
+
map 'object' => ''
|
356
|
+
map 'mailer' => ''
|
357
|
+
end
|
358
|
+
|
359
|
+
migration.map 'return_authorizations' => 'spree_return_authorizations'
|
360
|
+
map 'id'
|
361
|
+
map 'number'
|
362
|
+
map 'amount'
|
363
|
+
map 'order_id'
|
364
|
+
map 'reason'
|
365
|
+
map 'state'
|
366
|
+
map 'created_at'
|
367
|
+
map 'updated_at'
|
368
|
+
end
|
369
|
+
|
370
|
+
migration.map 'roles' => 'spree_roles'
|
371
|
+
map 'id'
|
372
|
+
map 'name'
|
373
|
+
end
|
374
|
+
|
375
|
+
migration.map 'roles_users' => 'spree_roles_users'
|
376
|
+
map 'role_id'
|
377
|
+
map 'user_id'
|
378
|
+
end
|
379
|
+
|
380
|
+
migration.map 'schema_migrations' do
|
381
|
+
map 'version'
|
382
|
+
end
|
383
|
+
|
384
|
+
migration.map 'shipments' => 'spree_shipments'
|
385
|
+
map 'id'
|
386
|
+
map 'order_id'
|
387
|
+
map 'shipping_method_id'
|
388
|
+
map 'tracking'
|
389
|
+
map 'created_at'
|
390
|
+
map 'updated_at'
|
391
|
+
map 'number'
|
392
|
+
map 'cost'
|
393
|
+
map 'shipped_at'
|
394
|
+
map 'address_id'
|
395
|
+
map 'state'
|
396
|
+
end
|
397
|
+
|
398
|
+
migration.map 'shipping_categories' => 'spree_shipping_categories'
|
399
|
+
map 'id'
|
400
|
+
map 'name'
|
401
|
+
map 'created_at'
|
402
|
+
map 'updated_at'
|
403
|
+
end
|
404
|
+
|
405
|
+
migration.map 'shipping_methods' => 'spree_shipping_methods'
|
406
|
+
map 'id'
|
407
|
+
map 'zone_id'
|
408
|
+
map 'name'
|
409
|
+
map 'created_at'
|
410
|
+
map 'updated_at'
|
411
|
+
end
|
412
|
+
|
413
|
+
migration.map 'shipping_rates' => ''
|
414
|
+
map 'id' => ''
|
415
|
+
map 'shipping_category_id' => ''
|
416
|
+
map 'shipping_method_id' => ''
|
417
|
+
end
|
418
|
+
|
419
|
+
migration.map 'snippets' => ''
|
420
|
+
map 'id' => ''
|
421
|
+
map 'slug' => ''
|
422
|
+
map 'content' => ''
|
423
|
+
map 'created_by' => ''
|
424
|
+
map 'modified_by' => ''
|
425
|
+
map 'created_at' => ''
|
426
|
+
map 'updated_at' => ''
|
427
|
+
end
|
428
|
+
|
429
|
+
migration.map 'state_events' => 'spree_state_events'
|
430
|
+
map 'id'
|
431
|
+
map 'stateful_id'
|
432
|
+
map 'user_id'
|
433
|
+
map 'name'
|
434
|
+
map 'created_at'
|
435
|
+
map 'updated_at'
|
436
|
+
map 'previous_state'
|
437
|
+
map 'stateful_type'
|
438
|
+
end
|
439
|
+
|
440
|
+
migration.map 'states' => 'spree_states'
|
441
|
+
map 'id'
|
442
|
+
map 'name'
|
443
|
+
map 'abbr'
|
444
|
+
map 'country_id'
|
445
|
+
end
|
446
|
+
|
447
|
+
migration.map 'tax_categories' => 'spree_tax_categories'
|
448
|
+
map 'id'
|
449
|
+
map 'name'
|
450
|
+
map 'description'
|
451
|
+
map 'created_at'
|
452
|
+
map 'updated_at'
|
453
|
+
map 'is_default'
|
454
|
+
end
|
455
|
+
|
456
|
+
migration.map 'tax_rates' => 'spree_tax_rates'
|
457
|
+
map 'id'
|
458
|
+
map 'zone_id'
|
459
|
+
map 'amount'
|
460
|
+
map 'created_at'
|
461
|
+
map 'updated_at'
|
462
|
+
map 'tax_category_id'
|
463
|
+
end
|
464
|
+
|
465
|
+
migration.map 'taxonomies' => 'spree_taxonomies'
|
466
|
+
map 'id'
|
467
|
+
map 'name'
|
468
|
+
map 'created_at'
|
469
|
+
map 'updated_at'
|
470
|
+
end
|
471
|
+
|
472
|
+
migration.map 'taxons' => 'spree_taxons'
|
473
|
+
map 'id'
|
474
|
+
map 'taxonomy_id'
|
475
|
+
map 'parent_id'
|
476
|
+
map 'position'
|
477
|
+
map 'name'
|
478
|
+
map 'created_at'
|
479
|
+
map 'updated_at'
|
480
|
+
map 'permalink'
|
481
|
+
map 'lft'
|
482
|
+
map 'rgt'
|
483
|
+
map 'icon_file_name'
|
484
|
+
map 'icon_content_type'
|
485
|
+
map 'icon_file_size'
|
486
|
+
map 'icon_updated_at'
|
487
|
+
map 'description'
|
488
|
+
end
|
489
|
+
|
490
|
+
migration.map 'trackers' => 'spree_trackers'
|
491
|
+
map 'id'
|
492
|
+
map 'environment'
|
493
|
+
map 'analytics_id'
|
494
|
+
map 'active'
|
495
|
+
map 'created_at'
|
496
|
+
map 'updated_at'
|
497
|
+
end
|
498
|
+
|
499
|
+
migration.map 'transactions' => ''
|
500
|
+
map 'id' => ''
|
501
|
+
map 'amount' => ''
|
502
|
+
map 'txn_type' => ''
|
503
|
+
map 'response_code' => ''
|
504
|
+
map 'avs_response' => ''
|
505
|
+
map 'cvv_response' => ''
|
506
|
+
map 'created_at' => ''
|
507
|
+
map 'updated_at' => ''
|
508
|
+
map 'original_creditcard_txn_id' => ''
|
509
|
+
map 'payment_id' => ''
|
510
|
+
map 'type' => ''
|
511
|
+
end
|
512
|
+
|
513
|
+
migration.map 'users' => 'spree_users'
|
514
|
+
map 'id'
|
515
|
+
map 'email'
|
516
|
+
map 'crypted_password' => ''
|
517
|
+
map 'salt' => ''
|
518
|
+
map 'remember_token'
|
519
|
+
map 'remember_token_expires_at' => ''
|
520
|
+
map 'created_at'
|
521
|
+
map 'updated_at'
|
522
|
+
map 'persistence_token'
|
523
|
+
map 'single_access_token' => ''
|
524
|
+
map 'perishable_token'
|
525
|
+
map 'login_count' => ''
|
526
|
+
map 'failed_login_count' => ''
|
527
|
+
map 'last_request_at'
|
528
|
+
map 'current_login_at' => ''
|
529
|
+
map 'last_login_at' => ''
|
530
|
+
map 'current_login_ip' => ''
|
531
|
+
map 'last_login_ip' => ''
|
532
|
+
map 'login'
|
533
|
+
map 'ship_address_id'
|
534
|
+
map 'bill_address_id'
|
535
|
+
map 'openid_identifier' => ''
|
536
|
+
map 'api_key'
|
537
|
+
end
|
538
|
+
|
539
|
+
migration.map 'variants' => 'spree_variants'
|
540
|
+
map 'id'
|
541
|
+
map 'product_id'
|
542
|
+
map 'sku'
|
543
|
+
map 'price'
|
544
|
+
map 'weight'
|
545
|
+
map 'height'
|
546
|
+
map 'width'
|
547
|
+
map 'depth'
|
548
|
+
map 'deleted_at'
|
549
|
+
map 'is_master'
|
550
|
+
map 'count_on_hand'
|
551
|
+
map 'cost_price'
|
552
|
+
end
|
553
|
+
|
554
|
+
migration.map 'zone_members' => 'spree_zone_members'
|
555
|
+
map 'id'
|
556
|
+
map 'zone_id'
|
557
|
+
map 'zoneable_id'
|
558
|
+
map 'zoneable_type'
|
559
|
+
map 'created_at'
|
560
|
+
map 'updated_at'
|
561
|
+
end
|
562
|
+
|
563
|
+
migration.map 'zones' => 'spree_zones'
|
564
|
+
map 'id'
|
565
|
+
map 'name'
|
566
|
+
map 'description'
|
567
|
+
map 'created_at'
|
568
|
+
map 'updated_at'
|
569
|
+
end
|
570
|
+
|
571
|
+
migration.run
|