-
-
Notifications
You must be signed in to change notification settings - Fork 236
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
script to transfer response templates #3549
script to transfer response templates #3549
Conversation
a1320e4
to
bbb1ce2
Compare
Codecov Report
@@ Coverage Diff @@
## master #3549 +/- ##
==========================================
+ Coverage 82.55% 82.56% +0.01%
==========================================
Files 343 343
Lines 23175 23175
Branches 3532 3532
==========================================
+ Hits 19131 19134 +3
+ Misses 2925 2922 -3
Partials 1119 1119
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if the same(ish) file being present twice is deliberate? Given the strong overlap with export-import-data
I think this would be better implemented as a flag (e.g. --update-templates
) on that existing script.
bbb1ce2
to
ef89ee8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I might be missing something but it looks like the flag isn't taken into account on L138 of export-import-data
so existing templates are always skipped. Also bin/transfer-updates-response-templates
is still hanging around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is crashing when trying to e.g. reimport a file I just exported:
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::Pg::st execute failed: ERROR: duplicate key value violates unique constraint "response_templates_body_id_title_key"
DETAIL: Key (body_id, title)=(21076, Action Scheduled - Blocked Drain) already exists.
[...]
at ./bin/export-import-data line 148
bin/export-import-data
Outdated
warn "Template with title $_->{title} already exists, skipping"; | ||
next; | ||
} | ||
my $template = $body->response_templates->new({ | ||
my $template = $body->response_templates->find_or_new({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't update the text or status of any existing templates unfortunately. find_or_new
will (I believe) only search on unique columns, meaning it'll match on body_id
and title
then skip over the values for text
and state
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sigh, yes :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌟
59696d3
to
141453b
Compare
Enables transferring of response templates between two installs.
141453b
to
a0d65bd
Compare
Enables transferring of response templates between two installs.