How about:
1. Save the database with "db.export_to_csv_file(open('somefile.csv',
'wb'))"
-- The csv file should only contain columns defined in the current
database. I have not checked this - seems reasonable.
2. Erase the entire contents of applications\myapp\databases
-- This includes the web2py migration info and the actual database
storage (for sqlite at least)
3. Regenerate database by surfing to any page
-- The migration mechanism will detect the absence of a database,
and recreate one per the current model
4. Refill the database with "db.import_from_csv_file(open
('somefile.csv', 'rb'))"
3. The migration mechanism will detect the absence of a database, and
recreate one per the current model
Karl
On Jan 15, 2:41 pm, Jeff Bauer <[email protected]> wrote:
> On 01/15/2010 03:36 PM, mdipierro wrote:
>
> > On Jan 15, 3:24 pm, Jeff Bauer<[email protected]> wrote:
> >> Use case: When I access my database outside of DAL, I've got
> >> a bunch of old columns that are no longer in use.
>
> > I assume you use sqlite. sqlite cannot drop columns.With a different
> > database (if migrate!=False) the database should be exactly what your
> > model say.
>
> I see: http://www.sqlite.org/faq.html#q11
>
> So no easy way to do this, but if I want to remove the
> clutter anyway I suppose I can:
>
> 1. export table to csv
> 2. drop the table
> 3. remove the column(s) from the csv file
> 4. turn off migration
> 5. import csv
> 6. turn on migration
>
> Have I left out any steps?
>
> -Jeff
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.