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
fix: [DPMMA-2252] point groups migration fix #13195
fix: [DPMMA-2252] point groups migration fix #13195
Conversation
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.
Nice catch! I firstly removed the schema changes added by this migration:
jan@mautic-web:/var/www/html$ php bin/console doctrine:migrations:execute 'Mautic\Migrations\Version20230621074925' --down -vvv
WARNING! You are about to execute a migration in database "db2" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
>
[notice] Executing Mautic\Migrations\Version20230621074925 down
[info] ++ reverting Mautic\Migrations\Version20230621074925
[debug] ALTER TABLE `point_group_contact_score` DROP FOREIGN KEY `FK_9D85A703E7A1254A`
[debug] ALTER TABLE `point_group_contact_score` DROP FOREIGN KEY `FK_9D85A703FE54D947`
[debug] ALTER TABLE `points` DROP FOREIGN KEY `FK_27BA8E29FE54D947`
[debug] ALTER TABLE `point_triggers` DROP FOREIGN KEY `FK_9CABD32FFE54D947`
[debug] ALTER TABLE `lead_points_change_log` DROP FOREIGN KEY `FK_949C2CCCFE54D947`
[debug] ALTER TABLE `points` DROP group_id
[debug] ALTER TABLE `point_triggers` DROP group_id
[debug] ALTER TABLE `lead_points_change_log` DROP group_id
[debug] DROP TABLE point_group_contact_score
[debug] DROP TABLE point_groups
[info] Migration Mautic\Migrations\Version20230621074925 reverted (took 118.2ms, used 22M memory)
[notice] finished in 128.5ms, used 22M memory, 1 migrations executed, 10 sql queries
And then applied again:
jan@mautic-web:/var/www/html$ php bin/console doctrine:migrations:execute 'Mautic\Migrations\Version20230621074925' --up -vvv
WARNING! You are about to execute a migration in database "db2" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
>
[notice] Executing Mautic\Migrations\Version20230621074925 up
[info] ++ migrating Mautic\Migrations\Version20230621074925
[debug] CREATE TABLE `point_groups`
(
`id` INT UNSIGNED AUTO_INCREMENT NOT NULL,
`is_published` TINYINT(1) NOT NULL,
`date_added` DATETIME DEFAULT NULL,
`created_by` INT DEFAULT NULL,
`created_by_user` VARCHAR(191) DEFAULT NULL,
`date_modified` DATETIME DEFAULT NULL,
`modified_by` INT DEFAULT NULL,
`modified_by_user` VARCHAR(191) DEFAULT NULL,
`checked_out` DATETIME DEFAULT NULL,
`checked_out_by` INT DEFAULT NULL,
`checked_out_by_user` VARCHAR(191) DEFAULT NULL,
`name` VARCHAR(191) NOT NULL,
`description` LONGTEXT DEFAULT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4
COLLATE `utf8mb4_unicode_ci`
ENGINE = InnoDB
ROW_FORMAT = DYNAMIC;
[debug] CREATE TABLE `point_group_contact_score`
(
`contact_id` BIGINT UNSIGNED NOT NULL,
`group_id` INT UNSIGNED NOT NULL,
`score` INT NOT NULL,
PRIMARY KEY (`contact_id`, `group_id`)
) DEFAULT CHARACTER SET utf8mb4
COLLATE `utf8mb4_unicode_ci`
ENGINE = InnoDB
ROW_FORMAT = DYNAMIC;
[debug] ALTER TABLE `points` ADD group_id INT UNSIGNED DEFAULT NULL
[debug] ALTER TABLE `point_triggers` ADD group_id INT UNSIGNED DEFAULT NULL
[debug] ALTER TABLE `lead_points_change_log` ADD group_id INT UNSIGNED DEFAULT NULL
[debug] ALTER TABLE `point_group_contact_score` ADD CONSTRAINT `FK_9D85A703E7A1254A` FOREIGN KEY (`contact_id`) REFERENCES `leads` (`id`) ON DELETE CASCADE
[debug] ALTER TABLE `point_group_contact_score` ADD CONSTRAINT `FK_9D85A703FE54D947` FOREIGN KEY (`group_id`) REFERENCES `point_groups` (`id`) ON DELETE CASCADE
[debug] ALTER TABLE `points` ADD CONSTRAINT `FK_27BA8E29FE54D947` FOREIGN KEY (`group_id`) REFERENCES `point_groups` (`id`) ON DELETE CASCADE
[debug] ALTER TABLE `point_triggers` ADD CONSTRAINT `FK_9CABD32FFE54D947` FOREIGN KEY (`group_id`) REFERENCES `point_groups` (`id`) ON DELETE CASCADE
[debug] ALTER TABLE `lead_points_change_log` ADD CONSTRAINT `FK_949C2CCCFE54D947` FOREIGN KEY (`group_id`) REFERENCES `point_groups` (`id`) ON DELETE CASCADE
[info] Migration Mautic\Migrations\Version20230621074925 migrated (took 199.5ms, used 26M memory)
[notice] finished in 209.1ms, used 26M memory, 1 migrations executed, 10 sql queries
There were no errors, everything was smooth 👍 Thank you!
First try: Syntax error or access violation: 1091 Can't DROP FOREIGN KEY `FK_72243719E7A1254A
|
Result: |
This pull request has been mentioned on Mautic Forums. There might be relevant details there: https://forum.mautic.org/t/mautic-upgrade-to-4-4-10-5-0-1-breaks/30440/2 |
@saschafoerster I've updated the down procedure, please try the |
LGTM, manually applied patch in |
This pull request has been mentioned on Mautic Forums. There might be relevant details there: https://forum.mautic.org/t/upgrade-from-mautic-4-4-10-5-0-1-problem/30494/4 |
Description:
This PR fixes the issue with point groups migration
Steps to test this PR:
ddev exec php bin/console doctrine:migrations:migrate