Created
December 30, 2011 00:00
-
-
Save dnordstrom/1536797 to your computer and use it in GitHub Desktop.
Command line progress of Spree upgrade/migration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Command line logging during Spree 0.11 to 1.0.0.rc1 migration. | |
# (Skipping source control commands.) | |
## | |
Sites | |
> rvm gemset create asgseedbank-1.0.0rc | |
Sites | |
> rvm gemset use asgseedbank-1.0.0rc | |
Sites | |
> gem install rails | |
Sites | |
> gem install bundler | |
Sites | |
> rails new asgseedbank.com -d mysql | |
Sites | |
> cd asgseedbank.com | |
asgseedbank.com | |
> vim Gemfile # https://gist.github.com/1537120 -- Adding Spree v1.0.0.rc1 gem | |
asgseedbank.com | |
> bundle install | |
Fetching git://github.com/spree/spree.git | |
remote: Counting objects: 71448, done. | |
remote: Compressing objects: 100% (26130/26130), done. | |
remote: Total 71448 (delta 46504), reused 66194 (delta 42201) | |
Receiving objects: 100% (71448/71448), 18.15 MiB | 209 KiB/s, done. | |
Resolving deltas: 100% (46504/46504), done. | |
[...] | |
Using spree_core (1.0.0.rc1) from git://github.com/spree/spree.git (at v1.0.0.rc1) | |
Using spree_auth (1.0.0.rc1) from git://github.com/spree/spree.git (at v1.0.0.rc1) | |
Using spree_api (1.0.0.rc1) from git://github.com/spree/spree.git (at v1.0.0.rc1) | |
Using spree_dash (1.0.0.rc1) from git://github.com/spree/spree.git (at v1.0.0.rc1) | |
Using spree_promo (1.0.0.rc1) from git://github.com/spree/spree.git (at v1.0.0.rc1) | |
Using spree_sample (1.0.0.rc1) from git://github.com/spree/spree.git (at v1.0.0.rc1) | |
Using spree (1.0.0.rc1) from git://github.com/spree/spree.git (at v1.0.0.rc1) | |
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. | |
asgseedbank.com | |
> git init [...] # Setting up Git -- all changes are now being tracked. | |
asgseedbank.com | |
> vim config/database.yml # Setting up database settings. | |
asgseedbank.com | |
> rails g spree:install | |
git://github.com/spree/spree.git (at v1.0.0.rc1) is not checked out. Please run `bundle install` | |
asgseedbank.com | |
> bundle install | |
Fetching git://github.com/spree/spree.git | |
remote: Counting objects: 71459, done. | |
remote: Compressing objects: 100% (26140/26140), done. | |
remote: Total 71459 (delta 46509), reused 66200 (delta 42201) | |
Receiving objects: 100% (71459/71459), 18.15 MiB | 195 KiB/s, done. | |
Resolving deltas: 100% (46509/46509), done. | |
[...] | |
Using spree_core (1.0.0.rc1) from git://github.com/spree/spree.git (at v1.0.0.rc1) | |
Using spree_auth (1.0.0.rc1) from git://github.com/spree/spree.git (at v1.0.0.rc1) | |
Using spree_api (1.0.0.rc1) from git://github.com/spree/spree.git (at v1.0.0.rc1) | |
Using spree_dash (1.0.0.rc1) from git://github.com/spree/spree.git (at v1.0.0.rc1) | |
Using spree_promo (1.0.0.rc1) from git://github.com/spree/spree.git (at v1.0.0.rc1) | |
Using spree_sample (1.0.0.rc1) from git://github.com/spree/spree.git (at v1.0.0.rc1) | |
Using spree (1.0.0.rc1) from git://github.com/spree/spree.git (at v1.0.0.rc1) | |
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. | |
asgseedbank.com | |
> rails g spree:site # *skipping* sample data | |
asgseedbank.com | |
> vim .gitignore # https://gist.github.com/1540216 -- Ignoring assets directory. | |
asgseedbank.com | |
> vim Gemfile # https://gist.github.com/1540181 -- Adding Sequel gem, SQL queries in simple scripts. | |
asgseedbank.com | |
> bundle install | |
asgseedbank.com | |
> mkdir db/upgrade; mkdir db/dumps # Directories for upgrade/migration scripts SQL dumps. | |
asgseedbank.com | |
> mysqldump -u root -proot asgseedbank > db/dumps/20111230_clean_install.sql # https://gist.github.com/1540277 | |
asgseedbank.com | |
> mysqldump -u root -proot asgseedbank --no-create-info > db/dumps/20111230_clean_install-no_create_info.sql # https://gist.github.com/1540285 | |
## | |
# At this point we have a working clean setup of Spree v1.0.0.rc1. | |
# `rails s` confirmed working. | |
## | |
asgseedbank.com | |
> cp ~/Downloads/asg.sql db/dumps/201112310105_old_sree_0.11.rb # Saving a dump of the original 0.11 site for use during migration. | |
asgseedbank.com | |
> mysql -u root -p | |
# Creating work-in-progress database and importing v1.0.0.rc1 dump. | |
mysql> create database asgseedbank_wip; | |
mysql> use asgseedbank_wip; | |
mysql> source /Users/Daniel/Sites/agseedbank.com/db/dumps/20111230_clean_install.sql; | |
# Creating database and importing old 0.11 dump. | |
mysql> create database asgseedbank_old; | |
mysql> use asgseedbank_old; | |
mysql> source /Users/Daniel/Sites/asgseedbank.com/db/dumps/20111231_old_spree_0.11.rb; | |
mysql> exit; | |
asgseedbank.com | |
> gem install migraine # Installing own recently create gem for migrating data. | |
asgseedbank.com | |
> vim db/upgrade/generate.rb # https://gist.github.com/1556482 -- Create Migraine generation file. | |
asgseedbank.com | |
> ruby db/upgrade/generate.rb # Running migration generator. | |
asgseedbank.com | |
> cat db/upgrade/migrate.rb # https://gist.github.com/1556487 -- Migration file that will migrate the data. | |
asgseedbank.com | |
> vim db/upgrade/migrate.rb # Adding migration mappings (destination info etc). | |
## | |
# Attempt 1 | |
# Using Spree migrations until one breaks, then using Migraine. | |
# | |
# State: asgseedbank_wip clean install, asgseedbank_old sourced with 0.11 dump | |
## | |
asgseedbank.com | |
> rake db:migrate:up [...] # Running #up for single migrations manually. Fails at 20111230021199_generate_anonymous_users.rb. From thereon complains about no 'spree_' prefix on tables. | |
asgseedbank.com | |
> mysqldump -u root -p asgseedbank_old > db/dumps/20120103_old_migrated_to_generate_users.sql # Dumping database, saving current state. | |
asgseedbank.com | |
> cp db/dumps/20120103_old_migrated_to_generate_users.sql db/dumps/20120103_old_migrated_to_generate_users_prefix_added.sql | |
asgseedbank.com | |
> vim db/dumps/20120103_old_migrated_to_generate_users_prefix_added.sql # Adding 'spree_' prefix to CREATE TABLE statements. | |
asgseedbank.com | |
> mysql -u root -p # Re-creating asgseedbank_old, sourcing it with prefixed SQL dump. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Database Schemas
v0.11
https://gist.github.com/1540580
v1.0.0.rc1
https://gist.github.com/1540360