I just finished a Community Server 2.0 to 2.1 SP2 upgrade project for a client (one of my clients, not for Telligent) who failed to tell me he had problems upgrading in the past because of database corruption. I emailed him after unexpectedly hitting upgrade problems and asked, "Is there something about the history of your Community Server 2.0 database that you want to tell me about?" [insert smiley here.]
So I then investigated the database patch situation, the incremental updates each CS upgrade applies in its upgrade script. These patches are stored in the table cs_SchemaVersion.
As you can see we have a few patches missing. Fortunately, I think I have every SQL upgrade script ever written stored with each of my archived DBVT SDK projects, so I went back to earlier releases and pulled a few pertinent patches. I quickly found out that the tables, constraints and so forth in that particular missing patch were already in the database. Hm.
You see, the problem lies in the fact that the Ugrade.SQL script checks to make sure all patches are applied by checking the contents of the cs_SchemaVersion table and if things are screwy, the current upgrade script won't apply its new patches.
Similar CS 2.0-to-2.1 missing patch incidents have occurred before, with The Johnny-on-the-Spot Wizard providing a SchemaPatch.sql script that you'll find on this CS Forums thread. I ran it, but still had problems.
What I ended up doing was filling in the cs_SchemaVersion pieces which did the trick and the upgrade script ran successfully.
Insert into cs_SchemaVersion(Major, Minor, Patch, InstallDate) values (2, 0, 41, GetDate())
Insert into cs_SchemaVersion(Major, Minor, Patch, InstallDate) values (2, 0, 42, GetDate())
Insert into cs_SchemaVersion(Major, Minor, Patch, InstallDate) values (2, 0, 45, GetDate())
Insert into cs_SchemaVersion(Major, Minor, Patch, InstallDate) values (2, 0, 50, GetDate())
Insert into cs_SchemaVersion(Major, Minor, Patch, InstallDate) values (2, 0, 51, GetDate())
Whew, Judy. That was a bad one!