Failed migration

I get the error below when moving from database version 35 to 40 for
trunk
version 923.
This worked fine when I tested it by just using it as a standalone, but
not
when I tried migrating my existing site.
What’s missing? The site itself is not operating properly while this is
not
migrated.

Processing GeneralController#migrate (for 192.168.5.104 at 2006-03-18
12:12:56) [GET]
Parameters: {“action”=>“migrate”, “controller”=>“admin/general”}
Rendering within layouts/administration

ActionController::MissingTemplate (Missing template
/web/blog/app/views/admin/general/migrate.rhtml):
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:930:in
assert_existance_of_template_file' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:653:inrender_file’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:595:in
render_with_no_layout' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/layout.rb:220:inrender_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:53:in
render' /usr/lib/ruby/1.8/benchmark.rb:293:inmeasure’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:53:in
render' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:854:inperform_action_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/filters.rb:332:in
perform_action_without_benchmark' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
/usr/lib/ruby/1.8/benchmark.rb:293:in measure' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/rescue.rb:82:in
perform_action' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:369:inprocess_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/session_management.rb:116:in
process' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:indispatch’
/usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:141:in
process_request' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:53:inprocess!’
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:600:in each_cgi' /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:ineach_cgi’
/usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:52:in
process!' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:22:inprocess!’
/public/dispatch.fcgi:24

A little clarification. I restarted the server and get “Application
error
(Rails)” with “Multiple migrations have the version number 1” in the
production.log…

Processing GeneralController#index (for 192.168.5.104 at 2006-03-18
12:22:09) [G
ET]
Parameters: {“action”=>“index”,
“controller”=>“admin/general”}Redirected
to http://www.shokk.com/blog/admin/general/update_database
Completed in 0.00158 (632 reqs/sec) | DB: 0.00007 (4%) | 302 Found [
http://www.shokk.com/blog/admin/]

Processing GeneralController#update_database (for 192.168.5.104 at
2006-03-18 12
:22:09) [GET] Parameters: {“action”=>“update_database”,
“controller”=>“admin/general”}
Rendering within layouts/administrationRendering
admin/general/update_database
Completed in 0.02420 (41 reqs/sec) | Rendering: 0.01875 (77%) | DB:
0.00021(0%) | 200 OK [
http://www.shokk.com/blog/admin/general/update_database]

Processing GeneralController#migrate (for 192.168.5.104 at 2006-03-18
12:22:11)
[POST] Parameters: {“action”=>“migrate”, “controller”=>“admin/general”}

ActiveRecord::DuplicateMigrationVersionError (Multiple migrations have
the
version number 1):
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2
/lib/active_record/migration.
rb:247:in assert_unique_migration_version' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2 /lib/active_record/migration. rb:238:in migration_classes’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2
/lib/active_record/connection
adapters/mysql_adapter.rb:185:in inject' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2 /lib/active_record/migration. rb:235:in migration_classes’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2
/lib/active_record/migration.
rb:223:in migrate' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2 /lib/active_record/migration. rb:190:in up’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2
/lib/active_record/migration.
rb:181:in migrate' /lib/migrator.rb:26:in migrate’
/app/controllers/admin/general_controller.rb:17:in migrate' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 /lib/action_controller/base.rb: 853:in perform_action_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2
/lib/action_controller/filters.
rb:332:in perform_action_without_benchmark' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 /lib/action_controller/benchmar king.rb:69:in perform_action_without_rescue’
/usr/lib/ruby/1.8/benchmark.rb:293:in measure' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 /lib/action_controller/benchmar king.rb:69:in perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2
/lib/action_controller/rescue.r
b:82:in perform_action' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 /lib/action_controller/base.rb: 369:in process_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2
/lib/action_controller/session

management.rb:116:in process' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in dispatch’
/usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:141:in
process_ request' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:53:in process!’
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:600:in each_cgi' /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:in each_cgi’
/usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:52:in
process!' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:22:in process!’
/public/dispatch.fcgi:24

And just one more detail, it also fails for another blog going from 39
to 40
with the same Multiple migrations message.

“Ernie O.” [email protected] writes:

And just to answer my own mail one more time… =)
The culprit is in the db/migrations directory. See first the problem site,
then the working site. The problem site has two migrations labeled 1_
The question is, where does that guy belong? Should that be
40_add_extended_html.rb
And why does 0_initial_schema.rb now show up?

It looks to me like a botched svn update gone wrong. 0_initial_schema.rb
and
1_add_extended_html.rb simply shouldn’t be there.

Let me guess, you didn’t update this with svn, but by copying files
from somewhere else. Delete 0_initial_schema.rb and
1_add_extended_html.rb and try the migration again; you should be
okay.

And just to answer my own mail one more time… =)
The culprit is in the db/migrations directory. See first the problem
site,
then the working site. The problem site has two migrations labeled 1_
The question is, where does that guy belong? Should that be
40_add_extended_html.rb
And why does 0_initial_schema.rb now show up?

[root@chewbacca blog]#ls db/migrate
0_initial_schema.rb 28_rename_redirect_to.rb
10_add_tags.rb 29_add_user_notification.rb
11_add_article_id.rb 2_add_user_email.rb
12_enlarge_settings.rb 30_index_sessions.rb
13_add_textfilters.rb 31_add_notifications_table.rb
14_move_text_filter_to_text_filter_id.rb 32_add_jabber_notification.rb
15_convert_mysql_to_innodb.rb 33_add_count_caching.rb
16_fix_is_primary_postgres.rb 34_boolify_published.rb
17_add_comment_user_id.rb
35_boolify_content_allow_foo.rb
18_add_guids.rb 36_add_tag_display_name.rb
19_add_whiteboards_to_content.rb 37_enlarge_ip_field.rb
1_add_extended_html.rb 38_add_blog_object.rb
1_initial_schema.rb
39_serialize_blog_attributes.rb
20_superclass_articles.rb 3_add_article_user_id.rb
21_superclass_comments.rb 4_add_sidebars.rb
22_superclass_trackbacks.rb 5_add_cache_table.rb
23_superclass_pages.rb 6_add_pages.rb
24_cleanup_contents.rb 7_add_permalink.rb
25_add_itunes_metadata.rb 8_add_page_title.rb
26_add_redirect_table.rb 9_add_article_guid.rb
27_set_comment_published_flag.rb
[root@chewbacca blog]#ls /web/quiticisms/blog/db/migrate
10_add_tags.rb 29_add_user_notification.rb
11_add_article_id.rb 2_add_user_email.rb
12_enlarge_settings.rb 30_index_sessions.rb
13_add_textfilters.rb 31_add_notifications_table.rb
14_move_text_filter_to_text_filter_id.rb 32_add_jabber_notification.rb
15_convert_mysql_to_innodb.rb 33_add_count_caching.rb
16_fix_is_primary_postgres.rb 34_boolify_published.rb
17_add_comment_user_id.rb
35_boolify_content_allow_foo.rb
18_add_guids.rb 36_add_tag_display_name.rb
19_add_whiteboards_to_content.rb 37_enlarge_ip_field.rb
1_initial_schema.rb 38_add_blog_object.rb
20_superclass_articles.rb
39_serialize_blog_attributes.rb
21_superclass_comments.rb 3_add_article_user_id.rb
22_superclass_trackbacks.rb 4_add_sidebars.rb
23_superclass_pages.rb 5_add_cache_table.rb
24_cleanup_contents.rb 6_add_pages.rb
25_add_itunes_metadata.rb 7_add_permalink.rb
26_add_redirect_table.rb 8_add_page_title.rb
27_set_comment_published_flag.rb 9_add_article_guid.rb
28_rename_redirect_to.rb

Do you have a recommendation on how I can get this back on track?

FIXED!
Since I haven’t set myself up to do a real svn updates, I’ve been doing
a
checkout of the trunk to another area where I do my testing, and then
copy
the new over the old working area. Bad move because one of the
migrations
was… err, migrated to another name. This page that I googled was the
tipoff… http://glu.ttono.us/articles/2005/10/27/the-joy-of-migrations

Deleting 1_initial_schema.rb was the fix. And hopefully someone learns
from
my mistake and sets it up right the first time. In fact, it would be
good
if the Typo instructions only dealt with svn so that its set up right
from
the start to handle updates from trunk or stable or whatever the case
may
be.

“Ernie O.” [email protected] writes:

the start to handle updates from trunk or stable or whatever the case may
be.

Um… you deleted the wrong one. Not that it matters unless you do
something stupid like trying to migrate all the way back to an empty
database, but you’ll get caught out next time there’s a migration as
well.

I still have the files so if I put the 1_initial_schema.rb back in place
and
remove 0_initial_schema.rb and
1_add_extended_html.rb, will I be in good shape?
Any suggestions for getting myself properly situated with svn in the
current
setup?

“Ernie O.” [email protected] writes:

I still have the files so if I put the 1_initial_schema.rb back in place and
remove 0_initial_schema.rb and
1_add_extended_html.rb, will I be in good shape?

Should be.

Any suggestions for getting myself properly situated with svn in the current
setup?

Err… run your production code from an svn managed directory?

Ernie I think that Piers is right.
the best way is to have 2 blogs.

a development one to test all the things, your improvements on plugins,
themes, etc… and
a production one with just the “stable updates” both blogs under svn, it
depends just on which update you willl upload.

I’m doing it since several months and it works well.

Le Samedi 18 Mars 2006 20:00, Piers C. a écrit :

OK, moved the right files into place. I do have two blogs for this. My
mistake was taking the fresh truck code and working with a copy of the
production database. The site code will have to be copied and then have
the
svn laid on top of that. But better still I’ll have to make sure that
the
Typo areas, production and test, are from svn as Piers suggests.
Thanks!

On Mar 18, 2006, at 11:00 AM, Piers C. wrote:

Any suggestions for getting myself properly situated with svn in
the current
setup?

Err… run your production code from an svn managed directory?

I personally have 3 checkouts on my machine (managed by svk), then
when I want to push to my production blog I use rsync with the
appropriate --delete and --exclude switches so it will delete
unnecessary code files but not delete any cache or public/files stuff.