I have field in tarantool space I no longer need.
local space = box.schema.space.create('my_space', {if_not_exists = true})
space:format({
{'field_1', 'unsigned'},
{'field_2', 'unsigned'},
{'field_3', 'string'},
})
How to remove field_2
if it's indexed and if it's not indexed?
There is no any convenient way to do it.
The first way, just declare this field as nullable and insert
NULL
value to this field. Yes, it will be stored physically but you could hide them from users. It's simple and not expensive.The second way, write in-place migration. It's not possible if you have indexed fields after field you want to drop (in your example it's
field_3
). And it's dangerous if you have a huge amount of data in this space.The third way is to create new space, migrate data into it and drop previous. Still it's quite dangerous.