mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-26 16:53:12 +08:00
Migrate protocol names from linked protocols in inventory if empty [SCI-7110]
This commit is contained in:
parent
bf6375aee6
commit
b405cadf22
2 changed files with 16 additions and 1 deletions
|
@ -0,0 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class FillEmptyProtocolNamesForLinkedTaskProtocols < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
execute(
|
||||
"UPDATE protocols " \
|
||||
"SET name = parent_protocols.name "\
|
||||
"FROM protocols parent_protocols "\
|
||||
"WHERE \"parent_protocols\".\"id\" = \"protocols\".\"parent_id\" "\
|
||||
"AND \"protocols\".\"protocol_type\" = #{Protocol.protocol_types['linked']} "\
|
||||
"AND \"protocols\".\"name\" IS NULL;"
|
||||
)
|
||||
end
|
||||
end
|
|
@ -8516,6 +8516,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
|||
('20220429083335'),
|
||||
('20220530144300'),
|
||||
('20220602120714'),
|
||||
('20220705091621');
|
||||
('20220705091621'),
|
||||
('20220818094636');
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue