mysql - 如何将用 Ruby 编写的 MySQL 查询转换为 SQL?

标签 mysql ruby

如何将用 Ruby 编写的 MySQL 查询转换为 SQL?

是这样的:

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

我想要这样的东西:

CREATE TABLE IF NOT EXISTS `academic_details` (
  `registration_id` int(11) NOT NULL AUTO_INCREMENT,
  `created_at` DATETIME,
  `updated_at` DATETIME,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

最佳答案

运行rake db:structure:dump,所有的表定义都会在db/structure.sql中生成

关于mysql - 如何将用 Ruby 编写的 MySQL 查询转换为 SQL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21552242/

相关文章:

mysql - 从另一个表插入不重复的内容

php - 从字符串参数获取变量 MySQL PHP

php - 停止从 CSV 插入第一行

ruby - 我们可以在 capybara/siteprism 的循环内导航到不同的页面吗?

php - MySQL分区高分表

php - 显示一对多关系

ruby - 只有非重复值的数组

ruby - 如何在 Bluehost 上安装特定版本的 Ruby 和 Rails?

javascript - 用JS显示和隐藏多个占用相同空间的div

ruby - 如何将 float 作为 rake 任务参数传递?