[英]How to generate SQL Server database from schema.rb file?
I have an MS SQL Server 2012 instance with managment studio and I have schema.rb file which contains the following: 我有一个带有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.
How to generate SQL Server database from that file? 如何从该文件生成SQL Server数据库?
First, is your Rails app properly configured to use MS SQL Server 2012 as its DB ? 首先,您的Rails应用程序是否已正确配置为使用MS SQL Server 2012作为其数据库 ?
If so, try running rake db:schema:load
task. 如果是这样,请尝试运行
rake db:schema:load
任务。
If that doesn't work, try running the rake db:setup
task. 如果那不起作用,请尝试运行
rake db:setup
任务。
You can find more detailed information about the rake
tasks here in this previous Stackoverflow answer: https://stackoverflow.com/a/10302357/631834 您可以在此以前的Stackoverflow答案中找到有关
rake
任务的更多详细信息: https : //stackoverflow.com/a/10302357/631834
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.