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

sqlt_deploy_hook gets called twice #38

Open
mrenvoize opened this issue Nov 5, 2015 · 2 comments
Open

sqlt_deploy_hook gets called twice #38

mrenvoize opened this issue Nov 5, 2015 · 2 comments

Comments

@mrenvoize
Copy link
Contributor

As the title says, the sqlt_deploy-hook can end up getting called twice, once for the versions tables only it seems and once for everything else.

@mrenvoize
Copy link
Contributor Author

I overcame it temporarily with the following in my Schema class.. hopefully it helps

use utf8;
package Rebus::Schema;

use strict;
use warnings;

use base 'DBIx::Class::Schema';

our $VERSION = 18;

__PACKAGE__->load_namespaces;

=head1 DEPLOY HOOKS

=head2 rebus triggers

=cut

sub sqlt_deploy_hook {
  my ($self, $sqlt_schema) = @_;

  # Hack to prevent hook being called for a second time (as thus fail) with DeploymentHandler
  return if @{$sqlt_schema->get_tables} == 1 and $sqlt_schema->get_tables->[0]->name eq 'dbix_class_deploymenthandler_versions';
  ...
  index's, triggers, whatever here
  ...
}

@mohawk2
Copy link
Collaborator

mohawk2 commented Mar 9, 2019

Is it your expectation that the hook wouldn't get called for installing the database-version RS? We could just local monkey-patch the hook out in that situation, which seems reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants