dbsrgits / dbix-class-schema-loader

Official GitHub remote for git.shadowcat.co.uk DBIx-Class-Schema-Loader.git
http://dbix-class.org/
11 stars 34 forks source link

"<foo_table> has no primary key" issued also for views [rt.cpan.org #25944] #44

Open rabbiveesh opened 1 year ago

rabbiveesh commented 1 year ago

Migrated from rt.cpan.org#25944 (status was 'open')

Requestors:

From radek@pld-linux.org on 2007-03-30 09:34:24 :

I'm loading a schema which contains views.

DBIx::Class::Schema::Loader::Base->_load_classess() unconditionally
whines about the lack of a primary key in tables it found.  For views,
this is pointless, as (at least in Postgres) it's not possible to mark
a column as one.

From aimass@cpan.org on 2009-04-12 22:47:21 :

I second this [old] request. 

It's an annoying -feature- ... perhaps a quick fix would be to 1) ignore
pk definition altogether for views, or 2) look for first column of view
to be named id and if so, add it is pk for ResultSource definition.

Does this affect anybody else? Are there any workarounds, suggestions of
a fix? I would gladly write up a patch if any comments received from the
comments above...

From rkitover@cpan.org on 2012-09-09 16:28:56 :

An update on this ticket:

the warning is now gone.

The proper fix for this is to detect views separately from tables and generate proper 
DBIx::Class::ResultSource::View classes with the view SQL so that they can be 
redeployed.

Until that is done, leaving this ticket open.