java - is there any possibility to maintain 5 latest versions of major file in MySql Db? -
subject::::is there possibility maintain 5 latest versions of major file in mysql db?
according proj req't need maintain latest 5 versions of file in mysql db, if version count reached 6 i've delete first version of file automatically..
is there path achieve requirement if plz me .thanks in advance
assuming store file in data column, can add versions_back
column, , use in update
, delete
statements, this:
table structure:
id versions_back data <other columns> -- ------------- ---- --------------- 10 0 .... .... 12 1 .... .... 13 2 .... .... 15 3 .... .... 17 4 .... ....
performing insertion:
update versioned_file set versions_back=versions_back+1 insert versioned_file(data, versions_back) values (<file-data>, 0) delete versioned_file versions_back >= 5