Skip to content

Commit 0650b44

Browse files
committed
doc: Add section for known migrations that will not work
[ci skip]
1 parent 8b28f71 commit 0650b44

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,13 @@ Specifies that newly-defined tables will be created, existing tables that are no
10261026

10271027
**Note:** It is up to you to understand how changes to an existing table might affect the data. For example, changing a DOUBLE column to a FLOAT will cause the precision of the value to be reduced so some significant digits may be lost (i.e. `1.123456789` would be reduced to `1.12346`). Furthermore, some changes to tables cannot be done and will cause an error. An example of this would be adding a column with the `NOT NULL` attribute to a non-empty table without specifying a default value.
10281028

1029+
##### Known Migrations That Will Not Work
1030+
1031+
+ Altering a column in a certain way when a different table references that column as a foreign key.
1032+
+ Normally this isn't a problem if the column type is being changed (since you'd also need to change the column type in the referencing table and `mysql-plus` can handle this case), but if only the column in the first table needs to change (such as modifying it's `AUTO_INCREMENT` value), the operation will fail because of the foreign key constraint.
1033+
+ **Workaround 1:** Manually remove the foreign key constraint from the referencing table (using SQL) before syncing.
1034+
+ **Workaround 2:** Remove the foreign key definition from the referencing table schema (i.e. by commenting it out) before syncing the column change, then restore the foreign key definition and re-sync.
1035+
10291036
### drop
10301037

10311038
All defined tables will be dropped and recreated.

jsdoc2md/README.hbs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ Specifies that newly-defined tables will be created, existing tables that are no
125125

126126
**Note:** It is up to you to understand how changes to an existing table might affect the data. For example, changing a DOUBLE column to a FLOAT will cause the precision of the value to be reduced so some significant digits may be lost (i.e. `1.123456789` would be reduced to `1.12346`). Furthermore, some changes to tables cannot be done and will cause an error. An example of this would be adding a column with the `NOT NULL` attribute to a non-empty table without specifying a default value.
127127

128+
##### Known Migrations That Will Not Work
129+
130+
+ Altering a column in a certain way when a different table references that column as a foreign key.
131+
+ Normally this isn't a problem if the column type is being changed (since you'd also need to change the column type in the referencing table and `mysql-plus` can handle this case), but if only the column in the first table needs to change (such as modifying it's `AUTO_INCREMENT` value), the operation will fail because of the foreign key constraint.
132+
+ **Workaround 1:** Manually remove the foreign key constraint from the referencing table (using SQL) before syncing.
133+
+ **Workaround 2:** Remove the foreign key definition from the referencing table schema (i.e. by commenting it out) before syncing the column change, then restore the foreign key definition and re-sync.
134+
128135
### drop
129136

130137
All defined tables will be dropped and recreated.

0 commit comments

Comments
 (0)