{"id": "changelog:alter-table-support-for-create-insert-upsert-and-update", "page": "changelog", "ref": "alter-table-support-for-create-insert-upsert-and-update", "title": "Alter table support for create, insert, upsert and update", "content": "The JSON write API can now be used to apply simple alter table schema changes, provided the acting actor has the new alter-table permission. ( #2101 ) \n The only alter operation supported so far is adding new columns to an existing table. \n \n \n The /db/-/create API now adds new columns during large operations to create a table based on incoming example \"rows\" , in the case where one of the later rows includes columns that were not present in the earlier batches. This requires the create-table but not the alter-table permission. \n \n \n When /db/-/create is called with rows in a situation where the table may have been already created, an \"alter\": true key can be included to indicate that any missing columns from the new rows should be added to the table. This requires the alter-table permission. \n \n \n /db/table/-/insert and /db/table/-/upsert and /db/table/row-pks/-/update all now also accept \"alter\": true , depending on the alter-table permission. \n \n \n Operations that alter a table now fire the new alter-table event .", "breadcrumbs": "[\"Changelog\", \"1.0a9 (2024-02-16)\"]", "references": "[{\"href\": \"https://github.com/simonw/datasette/issues/2101\", \"label\": \"#2101\"}]"}