Deleting and updating tables
To delete a table, use the drop_table
method.
User.drop_table()
DROP TABLE IF EXISTS user;
To update a table, use the update_table
method.
User.update_table()
ALTER TABLE user ADD COLUMN email TEXT;
There are some restrictions on updating tables
- The new column cannot have
unique
orprimary_key
set toTrue
. - The new column needs to have a default value or set as optional.
- You can rename, drop and add multiple columns at once but you cannot mix this tree operations in one call.