{"action":"created","issue":{"url":"https://api.github.com/repos/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/367","repository_url":"https://api.github.com/repos/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL","labels_url":"https://api.github.com/repos/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/367/labels{/name}","comments_url":"https://api.github.com/repos/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/367/comments","events_url":"https://api.github.com/repos/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/367/events","html_url":"https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/367","id":315835975,"node_id":"MDU6SXNzdWUzMTU4MzU5NzU=","number":367,"title":"Auto-increment value collision with data seeding with 2.1.0-preview2","user":{"login":"ykirkanahtar","id":10384335,"node_id":"MDQ6VXNlcjEwMzg0MzM1","avatar_url":"https://avatars1.githubusercontent.com/u/10384335?v=4","gravatar_id":"","url":"https://api.github.com/users/ykirkanahtar","html_url":"https://github.com/ykirkanahtar","followers_url":"https://api.github.com/users/ykirkanahtar/followers","following_url":"https://api.github.com/users/ykirkanahtar/following{/other_user}","gists_url":"https://api.github.com/users/ykirkanahtar/gists{/gist_id}","starred_url":"https://api.github.com/users/ykirkanahtar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ykirkanahtar/subscriptions","organizations_url":"https://api.github.com/users/ykirkanahtar/orgs","repos_url":"https://api.github.com/users/ykirkanahtar/repos","events_url":"https://api.github.com/users/ykirkanahtar/events{/privacy}","received_events_url":"https://api.github.com/users/ykirkanahtar/received_events","type":"User","site_admin":false},"labels":[{"id":355737763,"node_id":"MDU6TGFiZWwzNTU3Mzc3NjM=","url":"https://api.github.com/repos/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/labels/invalid","name":"invalid","color":"fbca04","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2018-04-19T11:26:32Z","updated_at":"2018-06-21T22:08:20Z","closed_at":"2018-04-28T07:28:08Z","author_association":"NONE","body":"Hi,\r\n\r\nIf i migrate database without seeding any data, there is no problem in auto-increment system. \r\nBut if i do data seeding, (after the EF Core 2.1 Preview2 update) we must fill \"id\" values and when i seed data with id values, it breaks auto-increment system in PostgreSql. To fix this problem, i have to alter all of the sequences about the tables that have been sent data.\r\n\r\nYou can see the error messages below;\r\n\r\nThis is the error message which has been created before seeding data without id values.\r\n**The seed entity for entity type 'Student' cannot be added because there was no value provided for the required property 'StundentId'.**\r\n\r\nAnd this is the error message from PostgreSql after seeding data with id values when i want to add another row on table\r\n**[23505] ERROR: duplicate key value violates unique constraint \"PK_Student\" Detail: Key (\"StundentId\")=(3) already exists.**\r\n\r\n  ```\r\n    public class Student\r\n    {\r\n        [Key]\r\n        [Required]\r\n        public int StundentId { get; set; }\r\n        [Required]\r\n        public int StundentNo { get; set; }\r\n        [Required]\r\n        public string Name { get; set; }\r\n        [Required]\r\n        public string Surname { get; set; }\r\n        [Required]\r\n        public Course course { get; set; }\r\n    }\r\n\r\n    public class Course\r\n    {\r\n        [Key]\r\n        [Required]\r\n        public int ClassId { get; set; }\r\n        [Required]\r\n        public string ClassName { get; set; }\r\n        [Required]\r\n        public string Section { get; set; }\r\n        [Required]\r\n        public List<Student> Students { get; set; }\r\n    }\r\n\r\n    public class StudentDBContext : DbContext\r\n    {\r\n        public StudentDBContext(DbContextOptions options) : base(options)\r\n        {\r\n        }\r\n        public DbSet<Student> Student { get; set; }\r\n        public DbSet<Course> Class { get; set; }\r\n        protected override void OnModelCreating(ModelBuilder modelBuilder)\r\n        {\r\n            modelBuilder.Entity<Course>().HasMany(p => p.Students);\r\n            modelBuilder.Entity<Student>().HasData(\r\n                new { StundentId = 3, StundentNo = 2243, Name = \"paul\", Surname = \"smith\", courseClassId = 1 },\r\n                new { StundentId = 4, StundentNo = 2244, Name = \"allen\", Surname = \"martin\", courseClassId = 1 }\r\n                );\r\n        }\r\n    }\r\n```"},"comment":{"url":"https://api.github.com/repos/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/comments/399258846","html_url":"https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/367#issuecomment-399258846","issue_url":"https://api.github.com/repos/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/367","id":399258846,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTI1ODg0Ng==","user":{"login":"dougbu","id":6431421,"node_id":"MDQ6VXNlcjY0MzE0MjE=","avatar_url":"https://avatars1.githubusercontent.com/u/6431421?v=4","gravatar_id":"","url":"https://api.github.com/users/dougbu","html_url":"https://github.com/dougbu","followers_url":"https://api.github.com/users/dougbu/followers","following_url":"https://api.github.com/users/dougbu/following{/other_user}","gists_url":"https://api.github.com/users/dougbu/gists{/gist_id}","starred_url":"https://api.github.com/users/dougbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougbu/subscriptions","organizations_url":"https://api.github.com/users/dougbu/orgs","repos_url":"https://api.github.com/users/dougbu/repos","events_url":"https://api.github.com/users/dougbu/events{/privacy}","received_events_url":"https://api.github.com/users/dougbu/received_events","type":"User","site_admin":false},"created_at":"2018-06-21T22:08:20Z","updated_at":"2018-06-21T22:08:20Z","author_association":"NONE","body":"Negative values for auto-increment columns in seeding data clears this problem for me when using the Pomelo.EntityFrameworkCore.MySql provider. It also does not break anything with the other providers I've been testing (Pomelo MySql, SQLite and SqlServer)."}}
{"actor":{"display_login":"dougbu"}}