0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

sqlite3 dump and restore

Posted at

dump

sqlite3 some.db .schema > schema.sql
sqlite3 some.db .dump > dump.sql
grep -vx -f schema.sql dump.sql > data.sql

rails dbconsole

$ rails dbconsole
> .output schema.sql
> .schema
> .output dump.sql
> .dump
> .quit
$ grep -vx -f schema.sql dump.sql > data.sql

restore

SQL ファイルを読み込む。

$ rails dbconsole
> .read data.sql
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?