title: MySQL auto increment on insert and update
body: <p>I have a MySQL database and I need to auto increment a column by 1 every time I do an insert or update. If I had to increment the column only during insert I could have used the built-in autoincrement option (usually used for primary keys). How can I do it for insert and updates?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Sorry, I posted the wrong question, what I actually need is to increase a counter by 1 every time I do an insert or update, the current value of the counter has to be stored in the row being created or updated. The counter starts from 1 and never comes back, it just keep increasing "forever" (BIGINT). Think of this counter as a <code>lastupdate</code> timestamp but instead of using real unix timestamps I use an ever increasing integer (monotonic increasing value).</p>
  
  <p>P.S. I'm implementing a syncronization mechanism between many local SQLite databases and one master MySQL database so the behavior has to be implemented on both dbms.</p>
  
  <p>The current state of the counter can be stored on a separate table of course</p>