[SQL-CVS] [ sqlobject-Patches-1539325 ] fromDatabase and delColumn for sqlite
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: SourceForge.net <no...@so...> - 2006-08-12 21:42:52
|
Patches item #1539325, was opened at 2006-08-12 14:42 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1539325&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Arlo Belshee (abelcodemonk) Assigned to: Nobody/Anonymous (nobody) Summary: fromDatabase and delColumn for sqlite Initial Comment: This patch implements both fromDatabase and delColumn for sqlite. I added sqlite to the appropriate existing tests; it passes them. fromDatabase is done by parsing the table creation sql from the sqlite_master table. This will work with any sqlite 3, and I think dates back into sqlite 2, but I'm not sure. delColumn is implemented by renaming the table, creating a new table without the one column, then copying all the data over. This is obviously not as efficient as on DBs that support drop column directly, but it works. This implementation of dropColumn does deal correctly with triggers, foreign keys, and indices that reference the table whose column is being dropped. It does not deal correctly with triggers & indices attached directly to the table being altered. Attached items will be lost. Extending the implementation to support re-creating those indices & triggers should be straightforward, but is beyond my needs. You are welcome to do so. Finally, this patch slightly improves the implementation of addColumn for sqlite. It performs a vacuum operation after each column add. See the sqlite documentation for why this is a good idea. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1539325&group_id=74338 |