Contrib T4 some fixes #338

Merged
merged 18 commits into from Jan 30, 2013
Commits on Nov 19, 2012
Commits on Nov 20, 2012
  1. [Contrib][T4][SQL Server] Fix retrive index definition when table dei…

    spaccabit committed Nov 20, 2012
    …nfinition has more index
    
    When you have table with this schema
    CREATE TABLE [Test Issue](
    [ID_Primary] [int] IDENTITY(1,1) NOT NULL,
    [Description] [nvarchar](50) NULL,
    [ID_Nation] [int] NOT NULL,
    CONSTRAINT [PK_Test Issue] PRIMARY KEY CLUSTERED
    (
    [ID_Primary] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY =
    OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    GO
    
    ALTER TABLE [Test Issue] ADD  CONSTRAINT [DF_Test Issue_ID_Nation]
    DEFAULT ((0)) FOR [ID_Nation]
    GO
    
    the T4 template generated the following incorrect migration:
    
    [Migration(20121120061957)]
    public class CreateInitialDB : Migration
    {
    public override void Up()
    {
    //For Test Issue
    Create.Table("Test Issue").InSchema("dbo")
    
    .WithColumn("ID_Primary").AsInt32().PrimaryKey().Identity().NotNullable()
    .WithColumn("Description").AsString().Nullable()
    .WithColumn("ID_Nation").AsInt32().NotNullable();
    
    Create.Index("IX_Nation").OnTable("Test Issue").InSchema("dbo")
    .OnColumn("ID_Nation").Ascending()
    .OnColumn("ID_Primary").Ascending();
    }
    
    public override void Down()
    {
    
    Delete.Index("IX_Nation");
    
    Delete.Table("Test Issue");
    }
    }
Commits on Nov 29, 2012
Commits on Nov 30, 2012
Commits on Dec 1, 2012
Commits on Dec 2, 2012
Commits on Dec 3, 2012