[Dbix-class] Re: Problems deploying a Postgres database that uses
robrwo at gmail.com
Mon Aug 13 07:43:54 GMT 2012
On 11/08/12 13:50 Robert Rothenberg wrote:
> I am working on a project that uses DBIx::Class but deploys the database
> using an SQL script. We'd like to use DBix::Class::DeploymentHandler or
> (preferably) DBIx::Class::Migration for deploying the databases, and
> handling upgrades.
> The database in question uses sequences for primary keys.
> If we use DBIx::Class's deploy method, the new database will have a similar
> schema. Importantly, it will use sequences, e.g. an "id" field will be
> defined "integer not null default nextval('table_id_seq'::regclass).
> This is all well and good, but we want a better way to handle upgrades (or
> possibly downgrades) and load data.
> If we use DBIx::Class::Migration, it sets the the primary keys to "serial"
OK, so serial is basically syntactic sugar for sequences. And either way, we
could live with that, except....
> Even worse though: when we populate the database with data, the sequences
> (well, "serial" counters) do not seem to be incremented properly, so adding
> new records fails. So is there a way to update sequences when using
Any ideas on this? Surely it's affected others?
More information about the DBIx-Class