[Dbix-class] Deploying schemas with autoincrement

Brian Cassidy brian.cassidy at gmail.com
Fri Mar 13 13:18:35 GMT 2009


On Fri, Mar 13, 2009 at 10:15 AM, Rob Kinyon <rob.kinyon at gmail.com> wrote:
> autoincrement is standard idea that every single RDBMS has a different
> way of implementing. Something like this will be supported in SQLA2,
> but not now. :-/
>
> Rob
>
> On Fri, Mar 13, 2009 at 07:11, Ian Wells <ijw at cack.org.uk> wrote:
>> I'm trying to do the above with $schema->deploy(), but I've not found
>> a database-agnostic way of describing the key column in the schema
>> (for instance, I have to use the Pg type 'serial' to get a Pg
>> deployment, which means that SQLite doesn't like it).
>>
>> I tried going backwards, generating the schema from the database, but
>> that comes up with even weirder stuff (default value of 'nextval(...)'
>> - exactly as postgres makes it happen, but again, not portable).

Errr... This is an SQL::Translator thing, actually. And you should be
able to use something like the following:

id => {
    data_type         => 'bigint',
    is_auto_increment => 1,
    is_nullable       => 0,
}

-Brian



More information about the DBIx-Class mailing list