title: Flyway & MariaDB: SQLException Foreign key constraint is incorrectly formed
body: <p>I'm currently trying to switch from Hibernate generating my ddl scheme to Flyway migrations. I generated my V1__Initial.sql script <a href="https://stackoverflow.com/questions/36966337/how-to-generate-a-ddl-creation-script-with-a-modern-spring-boot-data-jpa-and-h">by this means</a>. When I run it on an in-memory H2 database everything works fine. But when I try to run it on MariaDB I get the following exception:</p>
  
  <pre><code>Migration V1__Initial.sql failed
  --------------------------------
  SQL State  : HY000
  Error Code : 1005
  Message    : (conn=130) Can't create table `booking`.`booking_cancelled_event` (errno: 150 "Foreign key constraint is incorrectly formed")
  Location   : db/migration/V1__Initial.sql (C:\code\ajt\backend\target\classes\db\migration\V1__Initial.sql)
  Line       : 463
  Statement  : alter table booking_cancelled_event
     add constraint FKnxiyj0m730pl9ol2y4qng7577
     foreign key (cancelled_booking_id)
     references cancelled_internal_booking
  </code></pre>
  
  <p>The corresponding part from the V1__Initial.sql:</p>
  
  <pre><code>alter table booking_cancelled_event
     add constraint FKnxiyj0m730pl9ol2y4qng7577
     foreign key (cancelled_booking_id)
     references cancelled_internal_booking;
  </code></pre>
  
  <p>Output from <code>SHOW ENGINE InnoDB STATUS;</code>:</p>
  
  <pre><code>------------------------
  LATEST FOREIGN KEY ERROR
  ------------------------
  2019-06-23 21:07:30 0x1974 Error in foreign key constraint of table `xxx`.`booking_cancelled_event`:
  Alter  table `booking`.`booking_cancelled_event` with foreign key constraint failed. Parse error in '
     foreign key (cancelled_booking_id)
     references cancelled_internal_booking' near '
     references cancelled_internal_booking'.
  </code></pre>
  
  <p>Versions:  </p>
  
  <ul>
  <li><p>MariaDB 10.4  </p></li>
  <li><p>Spring Boot 2.1.5.RELEASE  </p></li>
  <li><p>Flyway 5.2.4  </p></li>
  </ul>