• I am studying the way how WP upgrading their database on each release, and see if I can model it in our application.

    Here is an example: Assume that you have a table “table1” with schema like this:

    version 1: table1(colA, colB, colC)
    version 2: table1(colA, colC)
    version 3: table1(colA, colB, colD)
    version 4: table1(colA, colB, colC, colD)

    If a person is in version 1 and want to upgrade to version 3, under current WP upgrading progress, it will upgrade in this procedure:

    version 1 > version 2 > version 3

    In other words, data in colB will be dropped in version 2. And colB is recovered and colC is dropped in version 3.

    The problem is, if someone upgrades in this procedure, data in colB will be deleted in version 3, which is in fact needed in version 3!!

    So I would like to know how WP team handles this kind of situation? Are there any articles talking about the progress of upgrading database in details?

    Thank you in advance for all your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    They don’t. It’s assumed once a table is no longer needed (which I don’t think has ever happened, but it could, in theory), then it is gone. Instead of bringing back B, they would make colE.

    @alucard001

    Like Ipstenu said, I don’t think ColB is recovered in the v2 > v3 upgrade. A new column may be created with default values in this case.

    Besides, I do not think that tables are ‘dropped’ for every upgrade. I believe they use the ‘ALTER TABLE’ SQL.

    I’m sure the code for upgrade is somewhere hidden within the black hole of wordpress core. You can always dig into it to find it out – if you have the patience, that is. ??

    Regards,
    Sterex

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How wordpress upgrading their database?’ is closed to new replies.