我正在尝试启动并运行应用程序,但是在运行时遇到了这个问题rake db:migrate
:
AddDueDateToProjectTodos: migrating =======================================
-- add_column(:project_todos, :due_date, :string)
rake aborted!
An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: no such table: project_todos: ALTER TABLE "project_todos" ADD "due_date" varchar(255)
我认为这可能源于开发人员删除迁移,因为他说他以前做过。
无论如何要解决这个问题还是我需要重新创建迁移?如果是这种情况,最好的解决方法是什么?
编辑
这是 database.yml 文件
# development:
# adapter: sqlite3
# encoding: utf8
# database: subscriptions_development
# username: root
# password:
#
# # Warning: The database defined as 'test' will be erased and
# # re-generated from your development database when you run 'rake'.
# # Do not set this db to the same as development or production.
# test:
# adapter: sqlite3
# encoding: utf8
# database: subscriptions_test
# username: root
# password:
#
# production:
# adapter: sqlite3
# encoding: utf8
# database: subscriptions_production
# username: root
# password:
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
这是架构
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20121218041922) do
create_table "accounts", :force => true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.string "full_domain"
t.datetime "deleted_at"
end
add_index "accounts", ["full_domain"], :name => "index_accounts_on_full_domain"
create_table "categories", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "name"
t.string "tutorial_id"
end
create_table "categories_tutorials", :force => true do |t|
t.integer "category_id"
t.integer "tutorial_id"
end
create_table "clients", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "address"
t.string "city"
t.string "company"
t.string "email"
t.string "name"
t.string "phone"
t.string "state"
t.string "website"
t.string "zip"
t.string "photo"
t.string "photo_file_name"
t.string "photo_content_type"
t.integer "photo_file_size"
t.datetime "photo_updated_at"
end
create_table "clients_projects", :force => true do |t|
t.integer "project_id"
t.integer "client_id"
end
create_table "contracts", :force => true do |t|
t.string "title"
t.integer "client_id"
t.string "body"
t.integer "status"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "custom_documents", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "title"
t.string "body"
t.integer "client_id"
t.boolean "status"
end
create_table "documents", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "invoices", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "project_comments", :force => true do |t|
t.integer "user_id"
t.integer "project_id"
t.string "comment"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "user_name"
end
create_table "project_files", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "title"
t.integer "project_id"
t.string "file_file_name"
t.string "file_content_type"
t.integer "file_file_size"
t.datetime "file_updated_at"
end
create_table "project_todo_comments", :force => true do |t|
t.string "comment"
t.integer "user_id"
t.integer "project_todo_id"
t.integer "project_todo"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "project_id"
end
create_table "project_todos", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "due_date"
t.string "title"
t.boolean "status"
t.integer "project_id"
t.datetime "due"
end
create_table "projectcommentations", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
t.string "user_name"
t.integer "comment_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "projectmemberizations", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
t.date "created_at", :null => false
t.datetime "updated_at", :null => false
end
# Could not dump table "projects" because of following StandardError
# Unknown type 'project' for column 'project_todo_due'
create_table "projects_clients", :force => true do |t|
t.integer "project_id"
t.integer "client_id"
end
create_table "projects_users", :force => true do |t|
t.integer "user_id"
t.integer "project_id"
end
create_table "projecttodocomments_projecttodos", :force => true do |t|
t.integer "project_todo_comment_id"
t.integer "project_todo_id"
end
create_table "proposals", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "body"
t.integer "client_id"
t.boolean "status"
t.string "title"
end
create_table "saas_admins", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "password_salt", :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "saas_admins", ["email"], :name => "index_admins_on_email", :unique => true
add_index "saas_admins", ["reset_password_token"], :name => "index_admins_on_reset_password_token", :unique => true
create_table "subscription_affiliates", :force => true do |t|
t.string "name"
t.decimal "rate", :precision => 6, :scale => 4, :default => 0.0
t.datetime "created_at"
t.datetime "updated_at"
t.string "token"
end
add_index "subscription_affiliates", ["token"], :name => "index_subscription_affiliates_on_token"
create_table "subscription_discounts", :force => true do |t|
t.string "name"
t.string "code"
t.decimal "amount", :precision => 6, :scale => 2, :default => 0.0
t.boolean "percent"
t.date "start_on"
t.date "end_on"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "apply_to_setup", :default => true
t.boolean "apply_to_recurring", :default => true
t.integer "trial_period_extension", :default => 0
end
create_table "subscription_payments", :force => true do |t|
t.integer "subscriber_id"
t.integer "subscription_id"
t.decimal "amount", :precision => 10, :scale => 2, :default => 0.0
t.string "transaction_id"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "setup"
t.boolean "misc"
t.integer "subscription_affiliate_id"
t.decimal "affiliate_amount", :precision => 6, :scale => 2, :default => 0.0
t.string "subscriber_type", :default => "User"
end
add_index "subscription_payments", ["subscriber_id", "subscriber_type"], :name => "index_subscription_payments_on_subscriber"
add_index "subscription_payments", ["subscription_id"], :name => "index_subscription_payments_on_subscription_id"
create_table "subscription_plans", :force => true do |t|
t.string "name"
t.decimal "amount", :precision => 10, :scale => 2
t.datetime "created_at"
t.datetime "updated_at"
t.integer "renewal_period", :default => 1
t.decimal "setup_amount", :precision => 10, :scale => 2
t.integer "trial_period", :default => 1
t.integer "user_limit"
t.float "unit_price"
t.text "description"
t.boolean "featured", :default => false
t.string "trial_interval", :default => "months"
end
create_table "subscriptions", :force => true do |t|
t.decimal "amount", :precision => 10, :scale => 2
t.datetime "next_renewal_at"
t.string "card_number"
t.string "card_expiration"
t.datetime "created_at"
t.datetime "updated_at"
t.string "state", :default => "trial"
t.integer "subscription_plan_id"
t.integer "subscriber_id"
t.integer "renewal_period", :default => 1
t.string "billing_id"
t.integer "user_limit"
t.integer "subscription_discount_id"
t.integer "subscription_affiliate_id"
t.string "subscriber_type", :default => "User"
end
add_index "subscriptions", ["subscriber_id", "subscriber_type"], :name => "index_subscriptions_on_subscriber_id_and_subscriber_type"
create_table "tutorials", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "content"
t.string "title"
t.integer "user_id"
t.integer "category_ids"
end
create_table "users", :force => true do |t|
t.string "name"
t.string "email", :null => false
t.string "encrypted_password", :null => false
t.string "password_salt", :null => false
t.datetime "last_sign_in_at"
t.datetime "current_sign_in_at"
t.string "last_sign_in_ip"
t.string "current_sign_in_ip"
t.integer "account_id"
t.boolean "admin", :default => false
t.datetime "created_at"
t.datetime "updated_at"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "reset_password_token"
t.string "remember_token"
t.datetime "remember_created_at"
t.integer "sign_in_count", :default => 0
t.integer "failed_attempts", :default => 0
t.string "unlock_token"
t.datetime "locked_at"
t.string "photo_file_name"
t.string "photo_content_type"
t.integer "photo_file_size"
t.datetime "photo_updated_at"
t.string "rate"
t.string "description"
t.string "web"
t.string "twitter"
t.string "dribbble"
t.string "github"
end
add_index "users", ["account_id"], :name => "index_users_on_account_id"
add_index "users", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true
add_index "users", ["email"], :name => "index_users_on_email"
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
add_index "users", ["unlock_token"], :name => "index_users_on_unlock_token", :unique => true
create_table "users_projects", :force => true do |t|
t.integer "user_id"
t.integer "project_id"
end
end