(changes []schema.TableColumnChange)
| 109 | } |
| 110 | |
| 111 | func (*Client) canAutoMigrate(changes []schema.TableColumnChange) bool { |
| 112 | for _, change := range changes { |
| 113 | switch change.Type { |
| 114 | case schema.TableColumnChangeTypeAdd: |
| 115 | if change.Current.PrimaryKey || change.Current.NotNull { |
| 116 | return false |
| 117 | } |
| 118 | case schema.TableColumnChangeTypeRemove: |
| 119 | if change.Previous.PrimaryKey || change.Previous.NotNull { |
| 120 | return false |
| 121 | } |
| 122 | case schema.TableColumnChangeTypeRemoveUniqueConstraint: |
| 123 | continue |
| 124 | default: |
| 125 | return false |
| 126 | } |
| 127 | } |
| 128 | return true |
| 129 | } |
| 130 | |
| 131 | // This is the responsibility of the CLI of the client to lock before running migration |
| 132 | func (c *Client) MigrateTables(ctx context.Context, msgs message.WriteMigrateTables) error { |
no outgoing calls
no test coverage detected