Skip to content
This repository

Contrib T4 some fixes #338

Merged
merged 18 commits into from about 1 year ago

2 participants

Giuseppe Lippolis Daniel Lee
Giuseppe Lippolis

Soame t4 fixes

added some commits November 19, 2012
Giuseppe Lippolis [Contrib][T4][SQL Server] Fix ForeignKey order definition b6cb12d
Giuseppe Lippolis [Contrib][T4] Add missing float datatype mapping 3af22b5
Giuseppe Lippolis [Contrib][T4][SQL Server] Fix retrive index definition when table dei…
…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");
}
}
b5bd428
Giuseppe Lippolis [Contrib][T4][Tests] Ignore generated class ffef436
Giuseppe Lippolis [Contrib][T4][Tests] Fix project reference 9cec840
Giuseppe Lippolis [Contrib][T4] Change type of Column.PropertyType from string to Syste…
…m.Data.DbType?
8fac7f8
Giuseppe Lippolis [Contrib][T4] Column CustomType e5b0b6a
Giuseppe Lippolis [Contrib][T4][SQl Server] Missing DefaultValue 546536f
Giuseppe Lippolis [Contrib][T4] Add DataReader Get<T> extension method ed40874
Giuseppe Lippolis [Contrib][T4][SQL Server] Fix retrive column size and precision 9d836bc
Giuseppe Lippolis [Contrib][T4] Fix T4 template drop ForeignKey and Index 571ef31
Giuseppe Lippolis [Contrib][T4] Fix detection of Guid DefaultValue 8defc3c
Giuseppe Lippolis [Contrib][T4] Fix detection of Byte DefaultValue 759debf
Giuseppe Lippolis [Contrib][T4] Remove unnecessary Bracket from DefaultValue 77a0fcd
Giuseppe Lippolis Merge branch 'master' of https://github.com/schambers/fluentmigrator 618660c
Giuseppe Lippolis [Contrib][T4] Add support at ForeignKey UpdateRule and DeleteRule 4fb41b3
Giuseppe Lippolis [Contrib][T4][SQL Server] ForeignKey UpdateRule and DeleteRule 23e14f8
Giuseppe Lippolis [Contrib][T4] Fix Binary(MAX) beb24f1
Daniel Lee
Collaborator

Thanks for the Pull Request and sorry about the delay. I'll test this out during the week.

Daniel Lee
Collaborator

Great work, this is starting to be usable! Especially when running against Sql Server 2008 or 2012.

Daniel Lee daniellee merged commit 0b66351 into from January 30, 2013
Daniel Lee daniellee closed this January 30, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 18 unique commits by 1 author.

Nov 19, 2012
Giuseppe Lippolis [Contrib][T4][SQL Server] Fix ForeignKey order definition b6cb12d
Giuseppe Lippolis [Contrib][T4] Add missing float datatype mapping 3af22b5
Nov 20, 2012
Giuseppe Lippolis [Contrib][T4][SQL Server] Fix retrive index definition when table dei…
…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");
}
}
b5bd428
Giuseppe Lippolis [Contrib][T4][Tests] Ignore generated class ffef436
Giuseppe Lippolis [Contrib][T4][Tests] Fix project reference 9cec840
Nov 29, 2012
Giuseppe Lippolis [Contrib][T4] Change type of Column.PropertyType from string to Syste…
…m.Data.DbType?
8fac7f8
Giuseppe Lippolis [Contrib][T4] Column CustomType e5b0b6a
Nov 30, 2012
Giuseppe Lippolis [Contrib][T4][SQl Server] Missing DefaultValue 546536f
Giuseppe Lippolis [Contrib][T4] Add DataReader Get<T> extension method ed40874
Giuseppe Lippolis [Contrib][T4][SQL Server] Fix retrive column size and precision 9d836bc
Giuseppe Lippolis [Contrib][T4] Fix T4 template drop ForeignKey and Index 571ef31
Dec 01, 2012
Giuseppe Lippolis [Contrib][T4] Fix detection of Guid DefaultValue 8defc3c
Giuseppe Lippolis [Contrib][T4] Fix detection of Byte DefaultValue 759debf
Giuseppe Lippolis [Contrib][T4] Remove unnecessary Bracket from DefaultValue 77a0fcd
Dec 02, 2012
Giuseppe Lippolis Merge branch 'master' of https://github.com/schambers/fluentmigrator 618660c
Dec 03, 2012
Giuseppe Lippolis [Contrib][T4] Add support at ForeignKey UpdateRule and DeleteRule 4fb41b3
Giuseppe Lippolis [Contrib][T4][SQL Server] ForeignKey UpdateRule and DeleteRule 23e14f8
Giuseppe Lippolis [Contrib][T4] Fix Binary(MAX) beb24f1
Something went wrong with that request. Please try again.