[Bug]: Migration fails adding foreign key constraint · Issue #4202 · opensourcepos/opensourcepos · GitHub
Skip to content

[Bug]: Migration fails adding foreign key constraint #4202

Description

@objecttothis

Bug Description?

While running 20250213000000_fix_attributes_cascading_delete.php line 18 generates

ALTER TABLE `ospos_attribute_links` ADD CONSTRAINT `ospos_attribute_links_ibfk_1` FOREIGN KEY (`definition_id`) REFERENCES `ospos_attribute_definitions` (`definition_id`) ON DELETE CASCADE;

This results in the error Cannot add foreign key constraint

Image

Steps to Reproduce?

  1. Clean database using database.sql from master
  2. Login for the first time to run migrations

Expected Behavior?

Migration runs on clean database with no errors.

OpensourcePOS Version

development (unreleased)

Php version

Php 8.3

What browsers are you seeing the problem on?

Firefox

Server Operating System and version

Windows 11

Database Management System and version

MySQL 8.4.3

Web Server and version

Apache 2.4.62

System Information Report (optional)

System Information Report

Unmodified copy of OpensourcePOS

  • I agree this copy has not been modified

Metadata

Metadata

Assignees

Labels

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions