mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +08:00
Add migration fixing wrong team reference for assets in repository snapshots [SCI-9929] (#6880)
This commit is contained in:
parent
e9d42beec4
commit
00cb69c4e2
1 changed files with 16 additions and 0 deletions
|
@ -0,0 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class FixTeamIdForClonedRepositoryAssets < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
execute(
|
||||
'UPDATE "assets" ' \
|
||||
'SET "team_id" = "repositories"."team_id" ' \
|
||||
'FROM "repositories" ' \
|
||||
'INNER JOIN "repository_columns" ON "repository_columns"."repository_id" = "repositories"."id" ' \
|
||||
'INNER JOIN "repository_cells" ON "repository_cells"."repository_column_id" = "repository_columns"."id" ' \
|
||||
'INNER JOIN "repository_asset_values" ON "repository_asset_values"."id" = "repository_cells"."value_id" ' \
|
||||
'AND "repository_cells"."value_type" = \'RepositoryAssetValue\' ' \
|
||||
'WHERE "assets"."team_id" != "repositories"."team_id"'
|
||||
)
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue