Re: [Dbix-class] PostgreSQL schema

2013-02-27 Thread Diab Jerius
On Thu, 2013-02-28 at 02:13 +1100, Peter Rabbitson wrote:
 On Wed, Feb 27, 2013 at 10:04:34AM -0500, Diab Jerius wrote:
  I'm trying to organize database objects using schema.  My primary server
  backend is Postgres.  The DBIC Pg storage docs indicate that it supports
  schema, but there's not much information anywhere that I can find in the
  DBIC documentation as to how one specifies schema.
  
  ...
  
  The quoting looks a bit weird.  In any case, upon deployment (via
  $schema-deploy) the tables are created, but Postgres balks at the extra
  '.' in the constraint names:
  
  NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index 
  pbk_hdrs_pkey for table pbk_hdrs
  DBIx::Class::Schema::deploy(): DBIx::Class::Schema::deploy(): DBI 
  Exception: DBD::Pg::db do failed: ERROR:  syntax error at or near .
  LINE 4:   CONSTRAINT acis.pbk_ccds_filename_ccd_id UNIQUE 
  (file...
 ^ at 
  lib/CXC/MSTDB/Deploy/ACIS/PBK/Deploy.pm line 51
   (running CREATE TABLE acis.pbk_ccds (
filename text NOT NULL,
ccd_id integer NOT NULL,
CONSTRAINT acis.pbk_ccds_filename_ccd_id UNIQUE (filename, 
  ccd_id)
  );
  CREATE INDEX acis.pbk_ccds_idx_filename on acis.pbk_ccds 
  (filename);
  
  ) at lib/CXC/MSTDB/Deploy/ACIS/PBK/Deploy.pm line 51
  DBIx::Class::Schema::deploy(): DBIx::Class::Schema::deploy(): DBI 
  Exception: DBD::Pg::db do failed: ERROR:  syntax error at or near .
  LINE 1: ...LTER TABLE acis.pbk_ccds ADD CONSTRAINT 
  acis.pbk_ccds...
   ^ at 
  lib/CXC/MSTDB/Deploy/ACIS/PBK/Deploy.pm line 51
   (running ALTER TABLE acis.pbk_ccds ADD CONSTRAINT 
  acis.pbk_ccds_fk_filename FOREIGN KEY (filename)
REFERENCES acis.pbk_hdrs (filename) ON DELETE CASCADE ON 
  UPDATE CASCADE DEFERRABLE;
  
  ) at lib/CXC/MSTDB/Deploy/ACIS/PBK/Deploy.pm line 51
  
  Am I going about this the wrong way?
  
 
 What are the versions of DBIx::Class and SQL::Translator you are using?
 
 perl -MDBIx::Class\ 999
 perl -MSQL::Translator\ 999
 
 Cheers
 

% perl -MDBIx::Class\ 999
DBIx::Class version 999 required--this is only version 0.08208.
BEGIN failed--compilation aborted.

% perl -MSQL::Translator\ 999
SQL::Translator version 999 required--this is only version 0.11016.
BEGIN failed--compilation aborted.




___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] PostgreSQL schema

2013-02-27 Thread Peter Rabbitson
On Wed, Feb 27, 2013 at 10:04:34AM -0500, Diab Jerius wrote:
 I'm trying to organize database objects using schema.  My primary server
 backend is Postgres.  The DBIC Pg storage docs indicate that it supports
 schema, but there's not much information anywhere that I can find in the
 DBIC documentation as to how one specifies schema.

You did it correctly. While DBIC does support schema specified that way 
for DML work, SQL::Translator (which is a separate project DBIC is using 
to do DDL) seems to get confused. However the culprit ultimately is 
still DBIC, because it names the constraints in a way that SQLT simply 
passes on. Please try to tweak 
https://github.com/dbsrgits/dbix-class/blob/master/lib/DBIx/Class/ResultSource.pm#L805
 
by doing something along the lines of $name =~ s/ ^ [\w\-]+ \. //x

If this works for you *please* get back to us and let us know so DBIC 
can be fixed in that regard.

Cheers


___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk