Closed WarlockNDF closed 1 month ago
Is it Possible To declare the SQL Default Value in the [Column] annotation so the ef migrates can automatic generate default value
public class TimeStamp { [Column("created_at", DefaultValue = "now()")] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public DateTime? Inserted { get; set; } [Column("updated_at", DefaultValue = "now()")] [DatabaseGenerated(DatabaseGeneratedOption.Computed)] public DateTime? LastUpdated { get; set; } }
EF Core version: Database provider: (e.g. Npgsql.EntityFrameworkCore.PostgreSQL 8.0.4) Target framework: (e.g. .NET 9) Operating system: Window 11 IDE: Rider
That's covered in the documentation. This can be done via the Fluent API, but not via attributes.
Is it Possible To declare the SQL Default Value in the [Column] annotation so the ef migrates can automatic generate default value
Include your code
Include provider and version information
EF Core version: Database provider: (e.g. Npgsql.EntityFrameworkCore.PostgreSQL 8.0.4) Target framework: (e.g. .NET 9) Operating system: Window 11 IDE: Rider