如何在sql中创建模式 [英] How to create schema in sql

查看:31
本文介绍了如何在sql中创建模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 http://edgeguides.rubyonrails.org/configuring.html这篇文章我在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(即使在我删除它之后),更重要的是,当我运行rake db:migrate"时它没有在 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.

推荐答案

嗯,这可能是一个 rails 错误,但你总是可以用这个来生成你的数据库结构:

Well, this could be a rails bug, but you can always generate your db structure with this:

rake db:structure:dump

这将使用 SQL 中的数据库结构为您生成一个#{Rails.env}.sql"文件.

This is going to generate an "#{Rails.env}.sql" file for you with your database structure in SQL.

这篇关于如何在sql中创建模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆