SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CreateUsers Migration Error

    I'm going through Simply Rails 2, and am on page 255. It is creating the users table.

    I generated the model, and then created the model it said to create:

    Code:
    class CreateUsers < ActiveRecord::Migration
      def self.up
        create_table :users do |t|
          t.string :login
          t.string :password
          t.string :name
          t.string :email
    
          t.timestamps
        end
        add_column :stories, :user_id, :integer
        add_column :votes, :user_id, :integer
      end
    
      def self.down
        drop_table :users
        remove_column :stories, :user_id
        remove_column :votes, :user_id
      end
    end
    When I run db:migrate, though, I get an error:

    Code:
    $ rake db:migrate
    (in /home/Brandon/projects/shovell)
    ==  CreateUsers: migrating ====================================================
    -- create_table(:users)
       -> 0.0970s
    -- add_column(:stories, :user_id, :integer)
    rake aborted!
    An error has occurred, all later migrations canceled:
    
    SQLite3::SQLException: unable to open database file: VACUUM
    
    (See full trace by running task with --trace)
    I don't understand this error at all. I couldn't migrate down, so I deleted db/development.sqlite3 and tried again. I got the same result at the same spot.

    I have Ruby 1.8.7, Rails 2.2.2, running on Cygwin.

    Why would this be happening?
    Laudetur Iesus Christus!
    Christ's Little Flock
    Jesus is the Good Shepherd

  2. #2
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I got it to work under MySQL, so I guess it's a SQLite issue, though I still don't understand why.
    Laudetur Iesus Christus!
    Christ's Little Flock
    Jesus is the Good Shepherd

  3. #3
    SitePoint Member
    Join Date
    Nov 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Had the same issue.

    Ended up deleting my /usr/local/bin and opt/local directories and reloading Ruby, Rails, etc. by following waavoo.com's 7 step guide through step 4 (i.e. just up to SQLite3, I didn't follow the MySQL path)

    I then followed your guidance and deleted my db/development.sqlite3 file and ran rake db:migrate

    presto it's alive.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •