Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the -o omit_view_definitions=1 option to remove the view definitions from server side views #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/DBIx/Class/Schema/Loader/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ __PACKAGE__->mk_group_ro_accessors('simple', qw/
generated_classes
omit_version
omit_timestamp
omit_view_definitions

relationship_attrs

Expand Down Expand Up @@ -904,6 +905,10 @@ Omit the package version from the signature comment.

Omit the creation timestamp from the signature comment.

=head2 omit_view_definitions

Omit the creation of view definitions

=head2 custom_column_info

Hook for adding extra attributes to the
Expand Down Expand Up @@ -2626,8 +2631,8 @@ sub _setup_src_meta {
$self->_dbic_stmt($table_class, 'table', $table->dbic_name);

# Must come after ->table
if ($is_view and my $view_def = $self->_view_definition($table)) {
$self->_dbic_stmt($table_class, 'result_source_instance->view_definition', $view_def);
if ( $is_view and my $view_def = $self->_view_definition( $table ) and not $self->omit_view_definitions ){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no point in getting the view definition if we're not going to emit it, so please move the check before the ->_view_definition call. Also, please refrain from unrelated whitespace changes.

$self->_dbic_stmt( $table_class,'result_source_instance->view_definition', $view_def );
}

my $cols = $self->_table_columns($table);
Expand Down