Inconsistent table creation

16 views
Skip to first unread message

Iwan Vosloo

unread,
Jun 22, 2012, 10:56:51 AM6/22/12
to sqle...@googlegroups.com
Hi there,

We've run into a problem which boils down to inconsistent behaviour of elixir when creating tables.  This may seem a bit of an esoteric question to ask, but it affects our ability to test using elixir test classes.

I'd like to think this is a subtle bug, but maybe this is meant to work this way? If so, is there a way to coax elixir to do this consistently?

Here's an example using sqlite (but the same issue happens regardless of database backend):

When I have a class hierarchy like so:

class ClassA(Entity):
    using_options(inheritance='multi')

class ClassADerived(ClassA):
    using_options(inheritance='multi')

create_all() results in table (for ClassA) that looks like this:

CREATE TABLE __main___classa (
id INTEGER NOT NULL, 
row_type VARCHAR(40), 
PRIMARY KEY (id)
)

This is as expected. But, if I omit the derived class, and only have:

class ClassA(Entity):
    using_options(inheritance='multi')

The table creation statement fails to include the row_type column:

CREATE TABLE __main___classa (
id INTEGER NOT NULL, 
PRIMARY KEY (id)
)

Reply all
Reply to author
Forward
0 new messages