1

I am using GRDB for local persistence.

Created a column in the Item table with the following constraints.

table.column(Item.CodingKeys.text.rawValue, .text).notNull()

Now I want to change it to support optional values as well.

table.column(Item.CodingKeys.text.rawValue, .text)

But in order to migrate, I cant alter its property. Only add, rename available for the column.

What approach should I take to properly migrate while keeping backward compatibility?

Joakim Danielson
  • 35,353
  • 5
  • 20
  • 45

1 Answers1

1

ALTER COLUMN is not possible in SQLite.

Only Supported alter operations:

  • Alter Table Name
  • Alter Table Column Name
  • Add New Column
  • Drop Column

Reference:

  • 1
    This shared [link](https://stackoverflow.com/questions/68555703/what-to-do-to-make-an-existing-non-optional-field-optional-in-database-table-in) answered it. – John Austin Jul 28 '21 at 07:21