Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem maping Datetime after switch database provider #159

Open
DancingOnWater opened this issue May 14, 2020 · 0 comments
Open

Problem maping Datetime after switch database provider #159

DancingOnWater opened this issue May 14, 2020 · 0 comments

Comments

@DancingOnWater
Copy link

DancingOnWater commented May 14, 2020

Start point:
1.Postgresql v 9.6
2. MsSQL 2008
3. .Net 4.7
4. EntityFramework6.Npgsql v 6.4.1

Datamodel like this:

public class ExploreModel:DbContext{
       public ExploreModel() : base("Explore"){}
       public DbSet<Rbi> RBI { get; set; }
 }
 public class Rbi{
       public int Id { get; set; }
       public DateTime Time { get; set; }
   }

If i add migration in one database i get migration like this:

public override void Up()
        {
            CreateTable(
                "dbo.Rbis",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Time = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
         }

Seems good, but after i switch on another and update database, entityframework throw exception: "there are some changes in model". if i try add new migration, i see such thing:
AlterColumn("dbo.Rbis", "Time", c => c.DateTime(nullable: false));
In another word: he let me migrate from datetime to datetime.

P.S. There is a compilable small project for problem demonstration in addition
NPGSQLError.zip
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant