Skip to content

Bug: Fail to upload a plugin [migration error] #5051

Open
@VannaKarenina

Description

Steps to reproduce the behavior

Trying to upload a plugin by file in mattermost settings.

Expected behavior

Installed plugin

Edition and Platform

  • Edition: Mattermost Boards (plugin)
  • Version: [v9.0.4]
  • Browser and OS: Chrome

Additional context (optional)

Error log:

{"timestamp":"2024-12-18 08:08:57.116 Z","level":"error","msg":"Table creation / migration failed","caller":"app/plugin_api.go:1011","plugin_id":"focalboard","error":"\"driver: postgres, message: failed to execute migration, command: executing_query, originalError: pq: повторяющееся значение ключа нарушает ограничение уникальности \"focalboard_boards_pkey\", query: \n\n\n\t\t\tdo $$\n\t\t\tbegin\n\t\t\t\tif (SELECT COUNT(table_name) FROM INFORMATION_SCHEMA.TABLES\n\t\t\t\t\t\t\tWHERE table_name = 'focalboard_teams'\n\t\t\t\t\t\t\tAND table_schema = 'public'\n\t\t\t\t) = 0 then\n\t\t\t\t\tALTER TABLE public.focalboard_workspaces RENAME TO focalboard_teams;\n\t\t\t\tend if;\n\t\t\tend$$;\n\t\t\n\t\t\tdo $$\n\t\t\tbegin\n\t\t\t\tif (SELECT COUNT(table_name) FROM INFORMATION_SCHEMA.COLUMNS\n\t\t\t\t\t\t\tWHERE table_name = 'focalboard_blocks'\n\t\t\t\t\t\t\tAND table_schema = 'public'\n\t\t\t\t\t\t\tAND column_name = 'channel_id'\n\t\t\t\t) = 0 then\n\t\t\t\t\tALTER TABLE public.focalboard_blocks RENAME COLUMN workspace_id TO channel_id;\n\t\t\t\tend if;\n\t\t\tend$$;\n\t\t\n\n\t\t\tdo $$\n\t\t\tbegin\n\t\t\t\tif (SELECT COUNT(table_name) FROM INFORMATION_SCHEMA.COLUMNS\n\t\t\t\t\t\t\tWHERE table_name = 'focalboard_blocks_history'\n\t\t\t\t\t\t\tAND table_schema = 'public'\n\t\t\t\t\t\t\tAND column_name = 'channel_id'\n\t\t\t\t) = 0 then\n\t\t\t\t\tALTER TABLE public.focalboard_blocks_history RENAME COLUMN workspace_id TO channel_id;\n\t\t\t\tend if;\n\t\t\tend$$;\n\t\t\nALTER TABLE public.focalboard_blocks DROP COLUMN IF EXISTS workspace_id;\n\n\nALTER TABLE public.focalboard_blocks_history DROP COLUMN IF EXISTS workspace_id;\n\nALTER TABLE public.focalboard_blocks ADD COLUMN IF NOT EXISTS board_id varchar(36) ;\n\n\nALTER TABLE public.focalboard_blocks_history ADD COLUMN IF NOT EXISTS board_id varchar(36) ;\n\n\n\nUPDATE focalboard_blocks SET fields = fields::jsonb - 'columnCalculations' || '{\"columnCalculations\": {}}' WHERE fields->>'columnCalculations' = '[]';\n\nWITH subquery AS (\n SELECT id, fields->'columnCalculations' as board_calculations from focalboard_blocks\n WHERE fields ->> 'columnCalculations' <> '{}')\nUPDATE focalboard_blocks b\n SET fields = b.fields::jsonb|| json_build_object('columnCalculations', s.board_calculations::jsonb)::jsonb\n FROM subquery AS s\n WHERE s.id = b.root_id\n AND b...."} {"timestamp":"2024-12-18 08:08:57.120 Z","level":"info","msg":"plugin process exited","caller":"plugin/hclog_adapter.go:61","plugin_id":"focalboard","wrapped_extras":"pluginplugins/focalboard/server/dist/plugin-linux-amd64id158"} {"timestamp":"2024-12-18 08:08:57.180 Z","level":"error","msg":"Unable to restart plugin on upgrade.","caller":"web/context.go:124","path":"/api/v4/plugins","request_id":"1ty94j4cetrtipxwyjy7g9hnqr","ip_addr":"10.193.254.46","user_id":"iayk41dn4jbszg71d6bwpamowe","method":"POST","err_where":"installExtractedPlugin","http_code":500,"error":"installExtractedPlugin: Unable to restart plugin on upgrade., cannot activate plugin: error initializing the DB: driver: postgres, message: failed to execute migration, command: executing_query, originalError: pq: повторяющееся значение ключа нарушает ограничение уникальности \"focalboard_boards_pkey\", query: \n\n\n\t\t\tdo $$\n\t\t\tbegin\n\t\t\t\tif (SELECT COUNT(table_name) FROM INFORMATION_SCHEMA.TABLES\n\t\t\t\t\t\t\tWHERE table_name = 'focalboard_teams'\n\t\t\t\t\t\t\tAND table_schema = 'public'\n\t\t\t\t) = 0 then\n\t\t\t\t\tALTER TABLE public.focalboard_workspaces RENAME TO focalboard_teams;\n\t\t\t\tend if;\n\t\t\tend$$;\n\t\t\n\t\t\tdo $$\n\t\t\tbegin\n\t\t\t\tif (SELECT COUNT(table_name) FROM INFORMATION_SCHEMA.COLUMNS\n\t\t\t\t\t\t\tWHERE table_name = 'focalboard_blocks'\n\t\t\t\t\t\t\tAND table_schema = 'public'\n\t\t\t\t\t\t\tAND column_name = 'channel_id'\n\t\t\t\t) = 0 then\n\t\t\t\t\tALTER TABLE public.focalboard_blocks RENAME COLUMN workspace_id TO channel_id;\n\t\t\t\tend if;\n\t\t\tend$$;\n\t\t\n\n\t\t\tdo $$\n\t\t\tbegin\n\t\t\t\tif (SELECT COUNT(table_name) ..."}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingTriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions