繁体   English   中英

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

[英]How to generate SQL Server database from schema.rb file?

我有一个带有managment studio的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数据库?

首先,您的Rails应用程序是否已正确配置为使用MS SQL Server 2012作为其数据库

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM