Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat would cause this migration to hang?
    primarykey
    data
    text
    <p>I'm trying to upgrade an old 1.2.6 Rails application to 2.3.8, and I'm running into a bit of a snag with migrations. Namely, if I have something like ModelName.create(:foo => "bar") in the migration, the migration doesn't complete. It doesn't hit an infinite loop or anything. It just refuses to complete that migration.</p> <p>Here's some sample code.</p> <p>This works:</p> <pre><code>class CreateNewsArticles &lt; ActiveRecord::Migration def self.up create_table :news_articles, :force =&gt; true do |t| t.string "name" t.string "image" t.text "body" t.boolean "featured", :default =&gt; "0" t.integer "position" t.timestamps end # Section.create(:name =&gt; 'News Articles', :controller =&gt; 'news_articles', :description =&gt; 'Add, edit, and delete news articles.') end def self.down drop_table :news_articles Section.find_by_name('News Articles').destroy end end </code></pre> <p>Uncommenting the Section.create(...) means the migration never completes. </p> <p>Here's the output from rake db:migrate --trace:</p> <pre><code>** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate == CreateNewsArticles: migrating ============================================= -- create_table(:news_articles, {:force=&gt;true}) -&gt; 0.0531s </code></pre> <p>And after commenting out the Section.create</p> <pre><code>** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate == CreateNewsArticles: migrating ============================================= -- create_table(:news_articles, {:force=&gt;true}) -&gt; 0.0479s == CreateNewsArticles: migrated (0.0481s) ==================================== ** Invoke db:schema:dump (first_time) ** Invoke environment ** Execute db:schema:dump </code></pre> <p>I've tried this on another computer, and it works. Same version of rake, same version of ruby, and rails is frozen.</p> <p>rake --VERSION: <code>rake, version 0.8.7</code>, ruby -v: <code>ruby 1.8.6 (2010-02-05 patchlevel 399) [i686-darwin10.3.0]</code>, rails -v: <code>Rails 2.3.8</code></p> <p>Anyone have any ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload