0

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
  • 43,251
  • 5
  • 22
  • 52

1 Answers1

0

ALTER COLUMN is not possible in SQLite.

Only Supported alter operations:

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

Reference:

tanmoy
  • 1,276
  • 1
  • 10
  • 28
  • 2
    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. –  Jul 28 '21 at 07:21