create rule

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

create rule

Adam Witney
Hi,

I want to use a CREATE RULE ON INSERT TO TABLE in my database (PostgreSQL) but I can't seem to figure out where I would put it in my Result class so that it is deployed with the schema.

Is this possible?

Thanks

Adam

_______________________________________________
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@...
Reply | Threaded
Open this post in threaded view
|

Re: create rule

Alexander Hartmaier
You can use an around method modifier on your schemas
deployment_statements method or do it the oldschool way like:

sub deployment_statements {
     my $self = shift;

     my @ret;
     my $wa = wantarray;

     my @additional_after_sql;

     # add Oracle specific stored functions
     if ( $self->storage->sqlt_type eq 'Oracle' ) {
         @additional_after_sql = (
            ...
          );
     }

     if ($wa) {
         @ret = $self->next::method(@_);
         push @ret, @additional_after_sql;
     }
     else {
         $ret[0] = $self->next::method(@_);
         $ret[0] .= join( ";\n\n", @additional_after_sql );
     }

     return $wa ? @ret : $ret[0];
}

Best regards, Alex

On 2015-04-25 17:26, Adam Witney wrote:

> Hi,
>
> I want to use a CREATE RULE ON INSERT TO TABLE in my database (PostgreSQL) but I can't seem to figure out where I would put it in my Result class so that it is deployed with the schema.
>
> Is this possible?
>
> Thanks
>
> Adam
>
> _______________________________________________
> 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@...



*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*

_______________________________________________
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@...