Alberto Simões wrote:
> I was pondering to backup an SQLite database using a version control
> system (probably SVN). Of course that if I add the binary file SVN
> will diff the entire file. That is not a good option.
> 
> I though on dumping the full database to SQL and put that file into svn.
> 
> I would like to ask:
>  - any comment on this? is it just stupid?
>  - if it is not stupid, how can I dump a full sqlite database to a
> text file that could be used later to restore the database?

If your database file isn't really small or you want the VC system to show you 
what changed between versions, then you would be best to dump it so that it is 
a 
plain text format which the VC would work best with.

A caveat here is that you'd want the dumper to follow some deterministic 
algorithm such as sorting all the rows when they are dumped so that different 
versions of the database show unchanged parts in the same order, so that VC's 
diff can be the most meaningful and efficient.

Since a SQL table's rows aren't naturally sorted, by definition, you can't 
count 
on a plain "select * from foo" giving rows in the same order.

Technically a table's columns aren't supposed to be ordered either, though SQL 
makes them so.

And of course, dump the schema and tables in a mutually consistent order.

-- Darren Duncan
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to