Bitbucket migration from MS SQL to MySQL failing Edited

I am in the process of migration our atlassian tools from MS SQL to MySQL and have hit a problem with the Bitbucket database migration.

As per the documentaion I have created a new database in MySQL and tested the connection during the database migration option in bitbucket.

However shortly after starting the migration it fails with the following error:
Error creating bean with name 'liquibasePrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is liquibase.exception.MigrationFailedException: Migration failed for change set liquibase/r3_10/upgrade.xml::STASH-5244-2::bturner:
Reason: liquibase.exception.DatabaseException: Error executing SQL UPDATE `bitbucketdb`.`cwd_user` SET `external_id` = NULL WHERE id IN (
SELECT a.id FROM (
SELECT b.id FROM cwd_user b JOIN (
SELECT c.directory_id, c.external_id FROM cwd_user c
GROUP BY c.directory_id, c.external_id
HAVING COUNT(*) > 1
) sq on b.directory_id = sq.directory_id AND b.external_id = sq.external_id
) a
): You can't specify target table 'cwd_user' for update in FROM clause:
I am running MySQL version 5.7.9, Bitbucket 4.14.4 and mysql-connector-java-5.1.43

Is there any solution/workaround to this problem?

Many thanks
 

1 answer

0 votes

Hi Andrew, I've seen you submitted a Support ticket regarding this same issue and one of my colleagues already helped you out with it :)

If you need further assistance or have some questions, let us know and we'll be glad to help!

Cheers,

Ana

I have the same problem with the migration form integrated bitbucket database to Mysql , how did you solve thwe issue? thanks

Bitbucket

The schema could not be created.
 com.atlassian.stash.internal.db.DefaultDatabaseManager.createSchema(DefaultDatabaseManager.java:341)
 com.atlassian.stash.internal.db.DefaultDatabaseManager.prepareDatabase(DefaultDatabaseManager.java:191)
 com.atlassian.stash.internal.maintenance.SpringMaintenanceTaskFactory.migrationTask(SpringMaintenanceTaskFactory.java:132)
 ...
Error creating bean with name 'liquibasePrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is liquibase.exception.MigrationFailedException: Migration failed for change set liquibase/r3_10/upgrade.xml::STASH-5244-2::bturner:
     Reason: liquibase.exception.DatabaseException: You can't specify target table 'cwd_user' for update in FROM clause [Failed SQL: UPDATE bitbucket.cwd_user SET external_id = NULL WHERE id IN (
                    SELECT a.id FROM (
                        SELECT b.id FROM cwd_user b JOIN (
                            SELECT c.directory_id, c.external_id FROM cwd_user c
                            GROUP BY c.directory_id, c.external_id
                            HAVING COUNT(*) > 1
                        ) sq on b.directory_id = sq.directory_id AND b.external_id = sq.external_id
                    ) a
                )]

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

274 views 0 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you