U4-4249 - PetaPocoExtensions CreateTable doesn't recreate the table

Created by Lee Kelleher 18 Feb 2014, 00:00:54 Updated by Sebastiaan Janssen 20 Aug 2014, 08:47:35

If you call PetaPocoExtensions.CreateTable with overwrite=true, if the table already exists, then it will be dropped... but then it wont be recreated.

The logic (from v6.2.0-bleeding;7.0.4+) is as follows...

var tableExist = db.TableExist(tableName); if (overwrite && tableExist) { db.DropTable(tableName); }

if (tableExist == false) {

The issue being, if the table already existed, tableExist would be true, then it would be dropped ... the following condition checks if tableExist is false, but it isn't.

Also, there is a fair amount of reflection up-top in this method... maybe it would be better to delay the reflection work until we know that the table is to be created?

I can supply a pull-request if needed?


Lee Kelleher 19 Aug 2014, 17:55:56

Pull request submitted: https://github.com/umbraco/Umbraco-CMS/pull/455

Priority: Normal

Type: Bug

State: Fixed

Assignee: Morten Christensen

Difficulty: Normal


Backwards Compatible: True

Fix Submitted: Pull request

Affected versions: 6.1.6, 7.0.4

Due in version: 7.1.5, 6.2.2


Story Points: