[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Issue #4358 - Svn WC 1.8 upgrade from 1.7 - wrong schema

From: Alan Barrett <apb_at_cequrux.com>
Date: Mon, 22 Apr 2013 22:40:34 +0200

On Mon, 22 Apr 2013, Bert Huijben wrote:
>Sqlite doesn't implement an ALTER table statement that can update this, so I
>don't think we should try to change this for 1.8.

You can copy the data to a temporary table; drop the old table; create a
new table with the new schema; and then copy everything back from the
temporary table. Do it all in a transaction and it should be reasonably
efficient. Like this:

     BEGIN;
     CREATE TEMP TABLE temp_foo AS SELECT * FROM foo;
     DROP TABLE foo;
     CREATE TABLE foo (col1 TYPE1, col2 TYPE2, col3 TYPE3);
     INSERT INTO foo SELECT col1, col2, col3 FROM temp_foo;
     DROP TABLE temp_foo;
     COMMIT;

--apb (Alan Barrett)
Received on 2013-04-22 22:41:09 CEST

This is an archived mail posted to the Subversion Dev mailing list.