U4-9204 - DatabaseSchemaHelper not having a generic method TableExists

Created by Mark Wemekamp 19 Nov 2016, 05:06:11 Updated by Sebastiaan Janssen 28 Jun 2018, 10:18:50

Tags: PR

Maybe there's a good reason for this, but I'm wondering why there is no generic implementation of the TableExists method in DatabaseSchemaHelper.

Both the CreateTable and the DropTable have a generic and a string parameter implementation, but for TableExists only the string parameter implementation exists.

I think it would be nice feature to a have generic method for TableExists to not have to worry about resolving the tablename myself


Søren Gregersen 19 Dec 2017, 20:23:39

@mwemekamp I just had the same "problem" ;)

I was able to implement this :

    public static class DatabaseSchemaHelperExtension
        public static bool TableExist<T>(this DatabaseSchemaHelper helper)
            var poco = Database.PocoData.ForType(typeof(T));

            return helper.TableExist(poco.TableInfo.TableName);

Søren Gregersen 02 Mar 2018, 12:00:22

pr with above code is here : https://github.com/umbraco/Umbraco-CMS/pull/2492

Priority: Normal

Type: Bug

State: Fixed


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.12.0


Story Points: