rails rake db:migrate sqllite3 error

时间:2017-12-05 13:00:26

标签: ruby-on-rails sqlite

StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: near "ENGINE": syntax error: CREATE TABLE "adv_bgs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "adv_bg_type" varchar, "adv_bg_id" integer, "uploaded_file_file_name" varchar, "uploaded_file_content_type" varchar, "uploaded_file_file_size" integer, "uploaded_file_updated_at" datetime, "head" boolean DEFAULT 'f', "imageable_id" integer, "imageable_type" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) ENGINE=MyISAM  DEFAULT CHARSET=utf8
/mnt/c/Users/direwolf/Documents/web/rails_projects/okar/db/migrate/20170425144835_init_schema.rb:4:in `up'
/home/jonsdirewolf/.rbenv/versions/2.4.0/bin/bundle:22:in `load'
/home/jonsdirewolf/.rbenv/versions/2.4.0/bin/bundle:22:in `<main>'
ActiveRecord::StatementInvalid: SQLite3::SQLException: near "ENGINE": syntax error: CREATE TABLE "adv_bgs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "adv_bg_type" varchar, "adv_bg_id" integer, "uploaded_file_file_name" varchar, "uploaded_file_content_type" varchar, "uploaded_file_file_size" integer, "uploaded_file_updated_at" datetime, "head" boolean DEFAULT 'f', "imageable_id" integer, "imageable_type" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) ENGINE=MyISAM  DEFAULT CHARSET=utf8
/mnt/c/Users/direwolf/Documents/web/rails_projects/okar/db/migrate/20170425144835_init_schema.rb:4:in `up'
/home/jonsdirewolf/.rbenv/versions/2.4.0/bin/bundle:22:in `load'
/home/jonsdirewolf/.rbenv/versions/2.4.0/bin/bundle:22:in `<main>'
SQLite3::SQLException: near "ENGINE": syntax error
/mnt/c/Users/direwolf/Documents/web/rails_projects/okar/db/migrate/20170425144835_init_schema.rb:4:in `up'
/home/jonsdirewolf/.rbenv/versions/2.4.0/bin/bundle:22:in `load'
/home/jonsdirewolf/.rbenv/versions/2.4.0/bin/bundle:22:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

我该怎么办? 20170425144835_init_schema.rb

class InitSchema < ActiveRecord::Migration
  def up

    create_table "adv_bgs", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "adv_bg_type"
      t.integer  "adv_bg_id"
      t.string   "uploaded_file_file_name"
      t.string   "uploaded_file_content_type"
      t.integer  "uploaded_file_file_size"
      t.datetime "uploaded_file_updated_at"
      t.boolean  "head",                       default: false
      t.integer  "imageable_id"
      t.string   "imageable_type"
      t.datetime "created_at",                                 null: false
      t.datetime "updated_at",                                 null: false
      t.index ["adv_bg_type", "adv_bg_id"], name: "index_adv_bgs_on_adv_bg_type_and_adv_bg_id", using: :btree
      t.index ["head"], name: "index_adv_bgs_on_head", using: :btree
    end

    create_table "adv_logos", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "adv_logo_type"
      t.integer  "adv_logo_id"
      t.string   "uploaded_file_file_name"
      t.string   "uploaded_file_content_type"
      t.integer  "uploaded_file_file_size"
      t.datetime "uploaded_file_updated_at"
      t.boolean  "head",                       default: false
      t.integer  "imageable_id"
      t.string   "imageable_type"
      t.datetime "created_at",                                 null: false
      t.datetime "updated_at",                                 null: false
      t.index ["adv_logo_type", "adv_logo_id"], name: "index_adv_logos_on_adv_logo_type_and_adv_logo_id", using: :btree
      t.index ["head"], name: "index_adv_logos_on_head", using: :btree
    end

    create_table "adv_pic1s", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "adv_pic1_type"
      t.integer  "adv_pic1_id"
      t.string   "uploaded_file_file_name"
      t.string   "uploaded_file_content_type"
      t.integer  "uploaded_file_file_size"
      t.datetime "uploaded_file_updated_at"
      t.boolean  "head",                       default: false
      t.integer  "imageable_id"
      t.string   "imageable_type"
      t.datetime "created_at",                                 null: false
      t.datetime "updated_at",                                 null: false
      t.index ["adv_pic1_type", "adv_pic1_id"], name: "index_adv_pic1s_on_adv_pic1_type_and_adv_pic1_id", using: :btree
      t.index ["head"], name: "index_adv_pic1s_on_head", using: :btree
    end

    create_table "adv_pic2s", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "adv_pic2_type"
      t.integer  "adv_pic2_id"
      t.string   "uploaded_file_file_name"
      t.string   "uploaded_file_content_type"
      t.integer  "uploaded_file_file_size"
      t.datetime "uploaded_file_updated_at"
      t.boolean  "head",                       default: false
      t.integer  "imageable_id"
      t.string   "imageable_type"
      t.datetime "created_at",                                 null: false
      t.datetime "updated_at",                                 null: false
      t.index ["adv_pic2_type", "adv_pic2_id"], name: "index_adv_pic2s_on_adv_pic2_type_and_adv_pic2_id", using: :btree
      t.index ["head"], name: "index_adv_pic2s_on_head", using: :btree
    end

    create_table "adv_pic3s", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "adv_pic3_type"
      t.integer  "adv_pic3_id"
      t.string   "uploaded_file_file_name"
      t.string   "uploaded_file_content_type"
      t.integer  "uploaded_file_file_size"
      t.datetime "uploaded_file_updated_at"
      t.boolean  "head",                       default: false
      t.integer  "imageable_id"
      t.string   "imageable_type"
      t.datetime "created_at",                                 null: false
      t.datetime "updated_at",                                 null: false
      t.index ["adv_pic3_type", "adv_pic3_id"], name: "index_adv_pic3s_on_adv_pic3_type_and_adv_pic3_id", using: :btree
      t.index ["head"], name: "index_adv_pic3s_on_head", using: :btree
    end

    create_table "adv_pic4s", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "adv_pic4_type"
      t.integer  "adv_pic4_id"
      t.string   "uploaded_file_file_name"
      t.string   "uploaded_file_content_type"
      t.integer  "uploaded_file_file_size"
      t.datetime "uploaded_file_updated_at"
      t.boolean  "head",                       default: false
      t.integer  "imageable_id"
      t.string   "imageable_type"
      t.datetime "created_at",                                 null: false
      t.datetime "updated_at",                                 null: false
      t.index ["adv_pic4_type", "adv_pic4_id"], name: "index_adv_pic4s_on_adv_pic4_type_and_adv_pic4_id", using: :btree
      t.index ["head"], name: "index_adv_pic4s_on_head", using: :btree
    end

    create_table "adv_pic5s", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "adv_pic5_type"
      t.integer  "adv_pic5_id"
      t.string   "uploaded_file_file_name"
      t.string   "uploaded_file_content_type"
      t.integer  "uploaded_file_file_size"
      t.datetime "uploaded_file_updated_at"
      t.boolean  "head",                       default: false
      t.integer  "imageable_id"
      t.string   "imageable_type"
      t.datetime "created_at",                                 null: false
      t.datetime "updated_at",                                 null: false
      t.index ["adv_pic5_type", "adv_pic5_id"], name: "index_adv_pic5s_on_adv_pic5_type_and_adv_pic5_id", using: :btree
      t.index ["head"], name: "index_adv_pic5s_on_head", using: :btree
    end

    create_table "adv_pic6s", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "adv_pic6_type"
      t.integer  "adv_pic6_id"
      t.string   "uploaded_file_file_name"
      t.string   "uploaded_file_content_type"
      t.integer  "uploaded_file_file_size"
      t.datetime "uploaded_file_updated_at"
      t.boolean  "head",                       default: false
      t.integer  "imageable_id"
      t.string   "imageable_type"
      t.datetime "created_at",                                 null: false
      t.datetime "updated_at",                                 null: false
      t.index ["adv_pic6_type", "adv_pic6_id"], name: "index_adv_pic6s_on_adv_pic6_type_and_adv_pic6_id", using: :btree
      t.index ["head"], name: "index_adv_pic6s_on_head", using: :btree
    end

    create_table "adv_pic7s", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "adv_pic7_type"
      t.integer  "adv_pic7_id"
      t.string   "uploaded_file_file_name"
      t.string   "uploaded_file_content_type"
      t.integer  "uploaded_file_file_size"
      t.datetime "uploaded_file_updated_at"
      t.boolean  "head",                       default: false
      t.integer  "imageable_id"
      t.string   "imageable_type"
      t.datetime "created_at",                                 null: false
      t.datetime "updated_at",                                 null: false
      t.index ["adv_pic7_type", "adv_pic7_id"], name: "index_adv_pic7s_on_adv_pic7_type_and_adv_pic7_id", using: :btree
      t.index ["head"], name: "index_adv_pic7s_on_head", using: :btree
    end

    create_table "advertising_applications", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.integer  "user_id"
      t.integer  "anon_user_id"
      t.integer  "televisor_id",                 limit: 1,                                     null: false
      t.integer  "advertising_public_status_id", limit: 1,     default: 1
      t.integer  "advertising_period_id",        limit: 1,     default: 1
      t.integer  "payment_status_id",            limit: 1,     default: 1
      t.integer  "step",                         limit: 1,     default: 1
      t.integer  "spec_id",                      limit: 1,     default: 1
      t.string   "email"
      t.string   "lnk"
      t.string   "redwords"
      t.string   "zkname"
      t.string   "zkdescr"
      t.integer  "price"
      t.integer  "charge",                       limit: 1,     default: 1
      t.datetime "endtime",                                    default: '2017-04-25 17:47:04'
      t.text     "comment",                      limit: 65535
      t.datetime "created_at",                                                                 null: false
      t.datetime "updated_at",                                                                 null: false
      t.index ["advertising_period_id"], name: "index_advertising_applications_on_advertising_period_id", using: :btree
      t.index ["advertising_public_status_id"], name: "index_advertising_applications_on_advertising_public_status_id", using: :btree
      t.index ["anon_user_id"], name: "index_advertising_applications_on_anon_user_id", using: :btree
      t.index ["payment_status_id"], name: "index_advertising_applications_on_payment_status_id", using: :btree
      t.index ["televisor_id"], name: "index_advertising_applications_on_televisor_id", using: :btree
      t.index ["user_id"], name: "index_advertising_applications_on_user_id", using: :btree
    end

    create_table "advertising_periods", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "value"
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
    end

    create_table "advertising_public_statuses", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "value"
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
    end

    create_table "anon_saved_searches", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "subtype",            limit: 3,     null: false
      t.string   "link_to",            limit: 64,    null: false
      t.string   "name",               limit: 32
      t.string   "category"
      t.string   "square_from",        limit: 24
      t.string   "square_to",          limit: 24
      t.string   "price_from",         limit: 24
      t.string   "price_to",           limit: 24
      t.string   "price_src",          limit: 3
      t.text     "data",               limit: 65535
      t.datetime "created_at",                       null: false
      t.datetime "updated_at",                       null: false
      t.text     "metro_data",         limit: 65535, null: false
      t.integer  "add_params_count",   limit: 1,                  unsigned: true
      t.integer  "main_city",          limit: 1,                  unsigned: true
      t.text     "location_tags_data", limit: 65535, null: false
    end

    create_table "anon_users", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "email"
      t.string   "access_level", limit: 16, default: "anon", null: false
      t.string   "access_code",  limit: 32,                  null: false
      t.datetime "created_at",                               null: false
      t.datetime "updated_at",                               null: false
      t.index ["email"], name: "index_anon_users_on_email", using: :btree
    end

    create_table "area_types", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "value"
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
    end

    create_table "avatars", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "imageable_type"
      t.integer  "imageable_id"
      t.string   "uploaded_file_file_name"
      t.string   "uploaded_file_content_type"
      t.integer  "uploaded_file_file_size"
      t.datetime "uploaded_file_updated_at"
      t.datetime "created_at",                 null: false
      t.datetime "updated_at",                 null: false
      t.index ["imageable_type", "imageable_id"], name: "index_avatars_on_imageable_type_and_imageable_id", using: :btree
    end

    create_table "bad_room_kinds", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "value"
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
    end

    create_table "bad_room_nums", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "value"
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
    end

    create_table "bad_room_presents", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "value"
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
    end

    create_table "balcons", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "value"
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
    end

    create_table "bg_cn_names", force: :cascade, options: "ENGINE=MyISAM  DEFAULT CHARSET=utf8" do |t|
      t.string   "value"
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
      t.index ["value"], name: "ivalue", type: :fulltext
    end

1 个答案:

答案 0 :(得分:2)

您在SQLite数据库中使用特定于MySQL的语法ENGINE=MyISAM DEFAULT CHARSET=utf8SQLite3::SQLException: near "ENGINE":