schema-changes.html 1.1 KB

12345678910111213141516171819202122232425
  1. Materialize supports schema changes in the upstream database as follows:
  2. #### Compatible schema changes
  3. - Adding columns to tables. Materialize will **not ingest** new columns added
  4. upstream unless you use [`DROP SOURCE`](/sql/alter-source/#context) to first
  5. drop the affected subsource, and then add the table back to the source using
  6. [`ALTER SOURCE...ADD SUBSOURCE`](/sql/alter-source/).
  7. - Dropping columns that were added after the source was created. These columns
  8. are never ingested, so you can drop them without issue.
  9. - Adding or removing `NOT NULL` constraints to tables that were nullable when
  10. the source was created.
  11. #### Incompatible schema changes
  12. All other schema changes to upstream tables will set the corresponding subsource
  13. into an error state, which prevents you from reading from the source.
  14. To handle incompatible [schema changes](#schema-changes), use [`DROP SOURCE`](/sql/alter-source/#context)
  15. and [`ALTER SOURCE...ADD SUBSOURCE`](/sql/alter-source/) to first drop the
  16. affected subsource, and then add the table back to the source. When you add the
  17. subsource, it will have the updated schema from the corresponding upstream
  18. table.