如何从schema.rb文件生成SQL Server数据库?

时间:2014-04-17 06:19:12

标签: mysql ruby-on-rails sql-server

我有一个带有管理工作室的MS SQL Server 2012实例,我有schema.rb文件,其中包含以下内容:

# This file is auto-generated from the current state of the database.
# Note that this schema.rb definition is the authoritative source for your database schema.

ActiveRecord::Schema.define(:version => 20120525100324) do

  create_table "academic_details", :force => true do |t|
    t.integer  "registration_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "additional_exam_groups", ["school_id"], :name => "index_additional_exam_groups_on_school_id", :limit => {"school_id"=>nil}

  create_table "additional_exam_scores", :force => true do |t|
    t.integer  "student_id"
    t.integer  "additional_exam_id"
    t.decimal  "marks",              :precision => 7, :scale => 2
    t.integer  "grading_level_id"
    t.string   "remarks"
    t.boolean  "is_failed"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "school_id"
  end.................etc.   

如何从该文件生成SQL Server数据库?

1 个答案:

答案 0 :(得分:1)

首先,是你的Rails app properly configured to use MS SQL Server 2012 as its DB

如果是,请尝试运行rake db:schema:load任务。

如果不起作用,请尝试运行rake db:setup任务。

您可以在此前的Stackoverflow答案中找到有关rake任务的更多详细信息:https://stackoverflow.com/a/10302357/631834