澳门银河网上官方赌场_老品牌值得信赖

ITKeyword,专注技术干货聚合推荐

注册 | 登录

解决ruby - How can I migrate my data from my rails app from mySql to SQLite

itPublisher 分享于

2020腾讯云限时秒杀,爆款1核2G云服务器99元/年!(领取2860元代金券),
地址https://cloud.tencent.com/act/cps/redirect?redirect=1062

2020阿里云最低价产品入口+领取代金券(老用户3折起),
入口地址https://www.aliyun.com/minisite/goods

推荐:6个有用的MySQL语句

1. 计算年数 你想通过生日来计算这个人有几岁了。 1 SELECT DATE_FORMAT(FROM_DAYS(TO_DAYS(now()) - TO_DAYS(@dateofbirth)), '%Y' ) + 0; 2. 两个时间的差 取

How can I migrate my data from my rails app from mySql to SQLite?

Is this possible?

ruby-on-rails ruby sqlite migration
|
  this question
edited Nov 16 '09 at 9:25 Simone Carletti 130k 27 273 313 asked Nov 14 '09 at 21:06 Verhogen 8,238 26 68 98

 | 

3 Answers
3

解决方法

Great question!

In the past I had to migrate Gb of databases from SQlite to MySQL to PostgreSQl and viceversa. I tried tons of utilities, scripts and tools but the only way I found to successfully migrate the database was to export the data into a database-free schema, then import the data.

This plugin saved my life thousands of times: yaml_db.


|
  this answer
answered Nov 16 '09 at 9:27 Simone Carletti 130k 27 273 313      Great link! I'm going to use this for my next migration. –  Matthew Rathbone Apr 4 '11 at 20:26

 | 

If you need to do it on the fly, via some sort of export method, you can just open a couple DB connections, one to your mysql db and one to your sqlite db, map the fields appropriately, and insert to your sqlite instance.

If you don't have to do it on the fly, there is this page.


|
  this answer
answered Nov 14 '09 at 21:10 Myles 12.7k 3 18 31

 | 

If you just want to move your data and schema from one to the other, this shouldn't be too hard, although if you are using one of the dark corners of mySQL, things might get hairier. Basically, you should dump your mySql database to some sort of file (there are a ton of ways to do this, for example from the command line or from something like phpmyAdmin) and then, if memory serves (it's been a while since I last did this stuff), do something like this:

sqlite3 <database name> ".import <export file name>"

Additionally, there is a script to automate this on the this page of the sqlite website, so you might see if it actually works.


|
  this answer
answered Nov 14 '09 at 21:21 Paul Wicks 21.1k 41 99 136

 | 


相关阅读排行


相关内容推荐

最新文章

×

×

请激活账号

为了能正常使用评论、编辑功能及以后陆续为用户提供的其他产品,请激活账号。

您的注册邮箱: 修改

重新发送激活邮件 进入我的邮箱

如果您没有收到激活邮件,请注意检查垃圾箱。

澳门银河网上官方赌场