UTC for registration

This commit is contained in:
Boris Milašinović
2026-04-20 00:09:10 +02:00
parent 6f56d107a2
commit b47ad41296
4 changed files with 6 additions and 6 deletions

View File

@@ -110,7 +110,7 @@ public partial class EventsContext : DbContext
entity.HasIndex(e => new { e.PersonId, e.SportId, e.EventId }, "UQ_Registration_PersonId_SportId_EventId").IsUnique(); entity.HasIndex(e => new { e.PersonId, e.SportId, e.EventId }, "UQ_Registration_PersonId_SportId_EventId").IsUnique();
entity.Property(e => e.RegisteredAt).HasDefaultValueSql("(sysdatetime())", "DF_Registration_RegisteredAt"); entity.Property(e => e.RegisteredAt).HasDefaultValueSql("(sysutcdatetime())", "DF_Registration_RegisteredAt");
entity.HasOne(d => d.Event).WithMany(p => p.Registrations) entity.HasOne(d => d.Event).WithMany(p => p.Registrations)
.HasForeignKey(d => d.EventId) .HasForeignKey(d => d.EventId)

View File

@@ -128,7 +128,7 @@ public partial class EventsContext : DbContext
entity.Property(e => e.PersonId).HasColumnName("person_id"); entity.Property(e => e.PersonId).HasColumnName("person_id");
entity.Property(e => e.RegisteredAt) entity.Property(e => e.RegisteredAt)
.HasDefaultValueSql("CURRENT_TIMESTAMP") .HasDefaultValueSql("CURRENT_TIMESTAMP")
.HasColumnType("timestamp without time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("registered_at"); .HasColumnName("registered_at");
entity.Property(e => e.SportId).HasColumnName("sport_id"); entity.Property(e => e.SportId).HasColumnName("sport_id");

View File

@@ -54,7 +54,7 @@ CREATE TABLE dbo.Registration (
PersonId int NOT NULL, PersonId int NOT NULL,
SportId int NOT NULL, SportId int NOT NULL,
EventId int NOT NULL, EventId int NOT NULL,
RegisteredAt datetime2 NOT NULL CONSTRAINT DF_Registration_RegisteredAt DEFAULT SYSDATETIME(), RegisteredAt datetime2 NOT NULL CONSTRAINT DF_Registration_RegisteredAt DEFAULT SYSUTCDATETIME(),
CONSTRAINT PK_Registration PRIMARY KEY CLUSTERED (Id), CONSTRAINT PK_Registration PRIMARY KEY CLUSTERED (Id),
CONSTRAINT FK_Registration_Person FOREIGN KEY (PersonId) REFERENCES dbo.Person(Id) ON DELETE CASCADE, CONSTRAINT FK_Registration_Person FOREIGN KEY (PersonId) REFERENCES dbo.Person(Id) ON DELETE CASCADE,
CONSTRAINT FK_Registration_Sport FOREIGN KEY (SportId) REFERENCES dbo.Sport(Id) ON DELETE CASCADE, CONSTRAINT FK_Registration_Sport FOREIGN KEY (SportId) REFERENCES dbo.Sport(Id) ON DELETE CASCADE,

View File

@@ -51,7 +51,7 @@ CREATE TABLE registration (
person_id INT NOT NULL, person_id INT NOT NULL,
sport_id INT NOT NULL, sport_id INT NOT NULL,
event_id INT NOT NULL, event_id INT NOT NULL,
registered_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, registered_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (person_id) REFERENCES person(id) ON DELETE CASCADE, FOREIGN KEY (person_id) REFERENCES person(id) ON DELETE CASCADE,
FOREIGN KEY (sport_id) REFERENCES sport(id) ON DELETE CASCADE, FOREIGN KEY (sport_id) REFERENCES sport(id) ON DELETE CASCADE,