如何创建SQL模式 [英] How to create schema in sql
问题描述
按<一个href="http://edgeguides.rubyonrails.org/configuring.html">http://edgeguides.rubyonrails.org/configuring.html和<一href="http://stackoverflow.com/questions/7012812/schema-rb-index-different-from-individual-migration-index">this帖子我有这样的application.rb中
As per http://edgeguides.rubyonrails.org/configuring.html and this post I have this in application.rb
config.active_record.schema_format = :sql
然而,它仍然创造DB / schema.rb(即使我删除),更重要的是它不是在创建SQL模式,当我运行耙分贝:迁移。任何人都知道我在做什么错了?我对Rails的3.1 pre。
However, it's still creating db/schema.rb (even after I delete it) and more importantly it's not creating the schema in sql when I run "rake db:migrate". Anyone know what I'm doing wrong? I'm on Rails 3.1 pre.
推荐答案
那么,这可能是一个错误轨道,但你总是可以生成你的数据库结构如下:
Well, this could be a rails bug, but you can always generate your db structure with this:
rake db:structure:dump
这将会产生一个#{Rails.env}的.sql文件,你在你的SQL数据库结构。
This is going to generate an "#{Rails.env}.sql" file for you with your database structure in SQL.
这篇关于如何创建SQL模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!