1

Closed

[user error, ignore] Add-Migration fails to generate a column for a new DateTime

description

We’ve upgraded to EF5 recently, and I’ve been adding a DateTime property LastUpdated to our PackageRegistration class - along with a bunch of other new properties
    // Sets a default Title to use for package versions that have no Title (instead of the PackageRegistration's ID).
    [StringLength(256)]
    public string DefaultTitle { get; set; }

    // These optional fields override the Package's fields as displayed on the website, if supplied:
    public string Description { get; set; }

    [StringLength(1024)]
    public string Summary { get; set; }

    [StringLength(256)]
    public string IconUrl { get; set; }

    [StringLength(256)]
    public string ProjectUrl { get; set; }

    [StringLength(256)]
    public string SourceCodeUrl { get; set; }

    [StringLength(256)]
    public string IssueTrackerUrl { get; set; }

    // Time the package registration data was modified, but excluding changes to 'ephemeral' data such as DownloadCount.
    DateTime LastUpdated { get; set; }
The apparent bug is that the LastUpdated column does not appear in the generated migration code generated by Add-Migration:
    public override void Up()
    {
        AddColumn("dbo.PackageRegistrations", "DefaultTitle", c => c.String(maxLength: 256));
        AddColumn("dbo.PackageRegistrations", "Description", c => c.String());
        AddColumn("dbo.PackageRegistrations", "Summary", c => c.String(maxLength: 1024));
        AddColumn("dbo.PackageRegistrations", "IconUrl", c => c.String(maxLength: 256));
        AddColumn("dbo.PackageRegistrations", "ProjectUrl", c => c.String(maxLength: 256));
        AddColumn("dbo.PackageRegistrations", "SourceCodeUrl", c => c.String(maxLength: 256));
        AddColumn("dbo.PackageRegistrations", "IssueTrackerUrl", c => c.String(maxLength: 256));
    }

Another wrinkle that may be important part of the the repro scenario is that the current (new) migration was generated with EF5, but the previous migration is an old one generated by EF4.
Here is the EF5 generated model string:

<data name="Target" xml:space="preserve">
<value>H4sIAAAAAAAEAO0dXXPjuO29M/0PHj+1nbk4yW1vrjfJ3eSS3W2m+zXr7L1mFJtx1JMlV5J3k/61PvQn9S9U3+IHAJISJdvZfcnEJAWCIAiCIED87z//PfvlcR1MPrM48aPwfHpydDydsHARLf1wdT7dpvff/Tj95ec//uHs5XL9OPmtbvd93i77MkzOpw9puvlpNksWD2ztJ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IWQ9DzGj1Y0b1LAS9WQ92Iael13ZWHE6WbshgCX71srQErO3Jgc9G+pYpPR+NzoOsU3OmUnsFWUPdAQ2Mc8H7Jvozh8/fJWE98G6JPvplZ5/XtI9ZxXU90iiQ5w3rk76ewXvk2RM9U/jOse+7uA+uda0J0ziVX0XUtRS6pHcsNoG7lpCCG4xVtpdiQxVbEqMUEEyZyFZFKbRUmX62kU3vaobYKXKBzjdpH4u1lFIIC2tJQVtUvl0sIiS8gk47xE64tsP0gHvSA1tcQoS5QFArM75n7UqyQtT9xWAZDFj3AgaESLuIHMkQDZ2Vg3LYuzvrDKDdCsJ4gFaxH8NkXmipX5BLdaXECEW63uG1Rxb8s3xMSkC6fACnMXUQH5RKINs6JAnkl4iTR+jB2HQD0naoNIqlG3RGjUeBwCuBpLR0NW9RDgUyWDude0BqJWaeTOzoauKoOI/kcnREAyH6BEkHjweSSEIpiDufhcEYG2PUGJ4WBq05PXYLQ2NF8asOQQ/YVMaQK6WJykMRRnRsw7ZJK79Vr4PIZSkw+5nSIldmXHiKczUa5uOeQhRAddYjUNbJGKdRk9nKvG8oHWTA72UAkweffIpNYL2Yflwj6izpDPZnM+TW8soxZIMjsZoOSD+cky1snN7vGwARSMk01dWez0sJTFWQ/lYxSZ7OP2zB/FqX8dcUSf9WCyPNkhWwhXLE0ba7D+6i+6pEwqpvIDyey1Ft6qXcRp/69t0iz6gVLksLo+JsXbAuLxh1bXofvt+lmm2ZDZuu7QNA+8xsjqv+zmYLz2fvifeTExRAyNP38JZn34a9bP1g2eL8CXpNAQORXUdUzQflc5pPOVk8NpHdRaAioIl9zg3bD1psgf4v3fTj3PjMcNz0NRYqdXfneKtOBkwpG+332M2O/5frx5/8DNphFS5wPAQA=</value>
</data>
Closed Apr 25, 2013 at 10:35 PM by RoMiller
Closing as requested by person who logged issue.

comments

tilovell wrote Apr 25, 2013 at 8:40 PM

Never mind! I just realized, as one often does, that I forgot to make the property public