DropTable that is OwnedBySuperoffice

Hi guys

I'm working on preparing a database for online migration by cleaning it up for unused modules, and while doing that i was working on removing some old tables that was left after getting rid of Amesto EDS a while ago. So since these tables has been added via CDD, i have been trying to create a Dictionary Step that Drops these old tables, and have created a LINQPad script for this purpose:

void Main()
{
	Connection.Open();
        // create a DatabaseManagement instance 
       var dbm = DatabaseManagement.CreateInstance("dbo", this.Connection);
 
            // ensure this is a version 8.1 or higher database
            var dbState = dbm.InspectDatabase();
            if (dbState == DatabaseManagement.DatabaseContent.SuperOfficeCdd){
                // get the database model - passed to DatabaseManagement for validation
                var model = dbm.ReadDatabaseModel();
				//model.Dump();
 
                //prepare the list of DictionarySteps as a LinkedList
                var steps = new LinkedList<DictionaryStep>(new[] { new UserQuery.UninstallEDS() });

                // apply the dictionary steps to the database model and physical database
                var result = dbm.ApplyDictionarySteps(steps, model); 
				}
}
 [Dictionary("UninstallEDS", 1, ReleaseState.Released)]
 public class UninstallEDS : DictionaryStep
    {
        public override void Structure()
        { 
			DropTable("PV_ABONNEMENTER");
			DropTable("PV_APP_OMKOSTNINGER");
			DropTable("PV_ETL_PERSONINTERESSER");
			DropTable("PV_K_ANDREADRESSER");
			DropTable("PV_K_DIFAKTOR");
			DropTable("PV_NETVAERK_GENEREL_INFO");
			DropTable("PV_NETVAERKSMEDLEMMER");
			DropTable("PV_NETVAERKSRELATIONER");
			DropTable("PV_SERVICETRAEK");
			DropTable("PV_SETUP_AKTIVITETSTATPER");
			DropTable("PV_SETUP_PRODUKT");
			DropTable("PV_SETUP_SALGSSTATUS");
			DropTable("PV_V_OVERENSKOMSTER");
			DropTable("PV_VIRK_KONFLIKTNOTAT");
			DropTable("PV_VIRK_OVERENSKOMSTNOTAT");
        }
    }

And that's all great, and the script compiles and runs, but an exception is thrown:

Fatal error: Table PV_ABONNEMENTER is OwnedBySuperoffice, the command Remove table PV_ABONNEMENTER is not. Fatal error., upgrade terminated before executing step UninstallEDS: UninstallEDS[1-Released]

So i dumped the model, as well as looking up the tables in the Devnet Toolbox, and surely enough - these 3rd party tables has somehow been created as system tables supposed to be maintained by SuperOffice.

So how can i override the "OwnedBySuperoffice" property on these tables in order to remove them properly? I presume i'm blocked doing this due to the potential mishap of deleting system tables such as the appointment table. But in this case, we are taling about tables that was created using EDS way before the idea of CDD was even conceived in the R&D office in Norway.... So is this possible?

Thanks for your help :)

RE: DropTable that is OwnedBySuperoffice

Hi Dennis!

From the article:

There is also a great discussion about this topic in the comments section of that article. 

That said, legacy third-party tables that were transformed during the 8.1 upgrade were all lumped into the same DictionaryStep name - if I'm not mistaken...it's been a minute since. I'll have to look into this a little more, no time right now though. Sorry. 

By: Tony Yates 15 Mar 2021