php - How to store version number in MySQL database -


i want store version number of application in mysql database ex:

version 1.1.0 1.1.1 1.1.2

which data type should use.

you have 2 options:

  1. use varchar

  2. use 3 numeric fields, major, minor, patch

  3. use both.

each option has advantages , disadvantages.

option 1 1 field, it's easy version. isn't sortable, since 2.0.0 lexicographically higher 10.0.0.

option 2 sortable, have 3 fields.

option 3 can implemented using view:

table tversion (   major number(3),   minor number(3),   patch number(3) )  view vversion    select major || '.' || minor || '.' || patch version,          major * 1000000 + minor * 1000 + patch sortorder tversion; 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -