[Nitro] [OG] - Automated table modification / extension

Ilias Lazaridis ilias at lazaridis.com
Sat Apr 30 14:41:47 EDT 2005


Ilias Lazaridis wrote:
[...]

> How do I setup OG that it automaticaly match the table to the updated
> class-definition? (= automaticly add columns).

after testing a little bit within the OG codebase:

-

At least SQLite3 has very limited support for table alteration.

The better alternative would be possibly:

  if table_exist
    table_create() # standard create method, suffix "_new"
    table_copy()   # generic copy method, usable for db-migration, too
    transaction
      table_rename() # <class-name>_old
      table_rename() # <class-name>_new => <class-name>
      table_delete() # delete old table
    end
  end

.

-- 
http://lazaridis.com




More information about the Nitro-general mailing list