Do you guys drop database columns? Its extra annoy...
# android-architecture
u
Do you guys drop database columns? Its extra annoying to do the temp table nonsense
b
Room's auto-migrations will help a LOT with this https://medium.com/androiddevelopers/room-auto-migrations-d5370b0ca6eb
u
yea I use sqldelight, shame
m
@ursus ¿why do you use temporal tables? ¿why the need to drop columns in a room database model? 🤔
u
well because my requirments changed and I dont need the column anymore, and wondering if I should drop or ignore it, however drop column only works from certain api level, so you need the temp table thing
m
@ursus you could use the @ignore annotation in the column you desire to uncheck.
@Ignore
is a Room-specific annotation, saying that Room should ignore that field or method.
u
yea I dont use room, but sqldelight
m
@ursus mmm right. with sqldelight, i think you've applied to write a delete statement or similar... but, sqlite has a limited feature about that:
SQLite supports a limited subset of ALTER TABLE. The ALTER TABLE command in SQLite allows the user to rename a table or to add a new column to an existing table. It is not possible to rename a column, remove a column, or add or remove constraints from a table.
I read the links below, and, i think it has to be a hard way to accomplish that, besides, the sqlite documentation is outdated and for recent versions, they have a valid usage of the drop column statement. link: 1. https://stackoverflow.com/questions/8442147/how-to-delete-or-add-column-in-sqlite 2. https://stackoverflow.com/questions/5938048/delete-column-from-sqlite-table/5987838#5987838