| 18 | } |
| 19 | |
| 20 | func needsTableDrop(change schema.TableColumnChange) bool { |
| 21 | switch change.Type { |
| 22 | case schema.TableColumnChangeTypeAdd: |
| 23 | return change.Current.NotNull || change.Current.PrimaryKey |
| 24 | case schema.TableColumnChangeTypeRemove: |
| 25 | return change.Previous.NotNull || change.Previous.PrimaryKey |
| 26 | case schema.TableColumnChangeTypeUpdate: |
| 27 | // allow changing string to large string without a table drop |
| 28 | if change.Previous.Type == arrow.BinaryTypes.String && change.Current.Type == arrow.BinaryTypes.LargeString { |
| 29 | return false |
| 30 | } |
| 31 | return true |
| 32 | default: |
| 33 | return true |
| 34 | } |
| 35 | } |