From 69cc73c374fc7b7018f544c22bcd283b8a519e73 Mon Sep 17 00:00:00 2001 From: XShine555 Date: Sun, 31 May 2026 18:25:39 +0200 Subject: [PATCH] Use long --- .../Configuration/PlayListConfiguration.cs | 4 +- .../Configuration/TrackConfiguration.cs | 8 +- Application/Contracts/IStreamTicketService.cs | 2 +- Application/Events/DeletePlayListEvent.cs | 2 +- Application/Events/DeleteTrackEvent.cs | 2 +- .../Commands/CreatePlayListCommand.cs | 2 +- .../Commands/DeletePlayListCommand.cs | 2 +- .../RequestPlayListPictureUploadCommand.cs | 2 +- .../Commands/UpdatePlayListCommand.cs | 2 +- .../Queries/GetPlayListsByUserIdQuery.cs | 2 +- Application/Services/UploadIntentValidator.cs | 4 +- .../Tracks/Commands/CreateTrackCommand.cs | 2 +- .../Tracks/Commands/DeleteTrackCommand.cs | 2 +- .../Commands/RequestTrackUploadUrlsCommand.cs | 2 +- .../Tracks/Queries/GetTrackStreamQuery.cs | 2 +- .../Tracks/Queries/GetTracksByUserIdQuery.cs | 2 +- .../Users/Commands/CreateUserCommand.cs | 2 +- Application/Users/Queries/GetUserByIdQuery.cs | 2 +- .../Responses/UserApplicationResponse.cs | 2 +- Domain/Entities/PlayList.cs | 2 +- Domain/Entities/UploadIntent.cs | 2 +- Domain/Entities/User.cs | 3 +- Domain/Entities/UserHasTrack.cs | 2 +- .../DeletePlayListRoutingSlipBuilder.cs | 2 +- .../Builders/DeleteTrackRoutingSlipBuilder.cs | 2 +- .../20260513230601_FirstMigration.Designer.cs | 332 ----------- ...514095113_AddMassTransitOutbox.Designer.cs | 512 ----------------- .../20260514095113_AddMassTransitOutbox.cs | 142 ----- ...60514161518_AddLifeCycleStatus.Designer.cs | 518 ------------------ .../20260514161518_AddLifeCycleStatus.cs | 40 -- .../20260514172047_AddUploadIntentTable.cs | 54 -- ... 20260530020027_InitialCreate.Designer.cs} | 23 +- ...ion.cs => 20260530020027_InitialCreate.cs} | 168 +++++- .../Migrations/DatabaseModelSnapshot.cs | 19 +- .../Services/StreamTicketService.cs | 2 +- 35 files changed, 216 insertions(+), 1655 deletions(-) delete mode 100644 Infrastructure/Persistence/Migrations/20260513230601_FirstMigration.Designer.cs delete mode 100644 Infrastructure/Persistence/Migrations/20260514095113_AddMassTransitOutbox.Designer.cs delete mode 100644 Infrastructure/Persistence/Migrations/20260514095113_AddMassTransitOutbox.cs delete mode 100644 Infrastructure/Persistence/Migrations/20260514161518_AddLifeCycleStatus.Designer.cs delete mode 100644 Infrastructure/Persistence/Migrations/20260514161518_AddLifeCycleStatus.cs delete mode 100644 Infrastructure/Persistence/Migrations/20260514172047_AddUploadIntentTable.cs rename Infrastructure/Persistence/Migrations/{20260514172047_AddUploadIntentTable.Designer.cs => 20260530020027_InitialCreate.Designer.cs} (97%) rename Infrastructure/Persistence/Migrations/{20260513230601_FirstMigration.cs => 20260530020027_InitialCreate.cs} (50%) diff --git a/Application/Configuration/PlayListConfiguration.cs b/Application/Configuration/PlayListConfiguration.cs index 9b03e7c..8290d26 100644 --- a/Application/Configuration/PlayListConfiguration.cs +++ b/Application/Configuration/PlayListConfiguration.cs @@ -61,7 +61,7 @@ namespace Musify.Application.Configuration public string BuildOriginalPicturePath(string pictureName) => CombineKey(ParentFolders, OriginalPicturesFolder, pictureName); - public string BuildOriginalPicturePath(Guid userId, string pictureName) => CombineKey(UploadsFolder, userId.ToString(), ParentFolders, OriginalPicturesFolder, pictureName); + public string BuildOriginalPicturePath(long userId, string pictureName) => CombineKey(UploadsFolder, userId.ToString(), ParentFolders, OriginalPicturesFolder, pictureName); public string BuildSmallPicturePath(string pictureName) => CombineKey(ParentFolders, SmallPicturesFolder, pictureName); @@ -70,7 +70,7 @@ namespace Musify.Application.Configuration public string BuildLargePicturePath(string pictureName) => CombineKey(ParentFolders, LargePicturesFolder, pictureName); // Temp path used in Phase 2 for pre-signed upload keys (moved to final on consumption) - public string BuildTempPicturePath(string tempRootPrefix, Guid userId, string objectName) => + public string BuildTempPicturePath(string tempRootPrefix, long userId, string objectName) => CombineKey(tempRootPrefix, userId.ToString(), ParentFolders, objectName); static string CombineKey(params string[] segments) diff --git a/Application/Configuration/TrackConfiguration.cs b/Application/Configuration/TrackConfiguration.cs index 10e2eec..4740944 100644 --- a/Application/Configuration/TrackConfiguration.cs +++ b/Application/Configuration/TrackConfiguration.cs @@ -71,7 +71,7 @@ namespace Musify.Application.Configuration public string BuildOriginalPicturePath(string pictureName) => CombineKey(OriginalPicturesPath, pictureName); - public string BuildOriginalPicturePath(Guid userId, string pictureName) => CombineKey(UploadsFolder, userId.ToString(), OriginalPicturesPath, pictureName); + public string BuildOriginalPicturePath(long userId, string pictureName) => CombineKey(UploadsFolder, userId.ToString(), OriginalPicturesPath, pictureName); public string BuildSmallPicturePath(string pictureName) => CombineKey(SmallPicturesPath, pictureName); @@ -81,15 +81,15 @@ namespace Musify.Application.Configuration public string BuildOriginalAudioPath(string audioName) => CombineKey(OriginalAudiosPath, audioName); - public string BuildOriginalAudioPath(Guid userId, string audioName) => CombineKey(UploadsFolder, userId.ToString(), OriginalAudiosPath, audioName); + public string BuildOriginalAudioPath(long userId, string audioName) => CombineKey(UploadsFolder, userId.ToString(), OriginalAudiosPath, audioName); public string BuildProcessedAudioPath(string audioName) => CombineKey(ProcessedAudiosPath, audioName); // Temp paths used in Phase 2 for pre-signed upload keys (moved to final on consumption) - public string BuildTempPicturePath(string tempRootPrefix, Guid userId, string objectName) => + public string BuildTempPicturePath(string tempRootPrefix, long userId, string objectName) => CombineKey(tempRootPrefix, userId.ToString(), ParentFolder, objectName); - public string BuildTempAudioPath(string tempRootPrefix, Guid userId, string objectName) => + public string BuildTempAudioPath(string tempRootPrefix, long userId, string objectName) => CombineKey(tempRootPrefix, userId.ToString(), ParentFolder, objectName); static string CombineKey(params string[] segments) diff --git a/Application/Contracts/IStreamTicketService.cs b/Application/Contracts/IStreamTicketService.cs index 21b6f50..f72282b 100644 --- a/Application/Contracts/IStreamTicketService.cs +++ b/Application/Contracts/IStreamTicketService.cs @@ -2,7 +2,7 @@ namespace Musify.Application.Contracts { public interface IStreamTicketService { - StreamTicket IssueTicket(Guid userId, string keyPrefix); + StreamTicket IssueTicket(long userId, string keyPrefix); } public record StreamTicket(string Token, int ExpiresInSeconds); diff --git a/Application/Events/DeletePlayListEvent.cs b/Application/Events/DeletePlayListEvent.cs index 0c068df..06a7a2c 100644 --- a/Application/Events/DeletePlayListEvent.cs +++ b/Application/Events/DeletePlayListEvent.cs @@ -2,5 +2,5 @@ namespace Musify.Application.Events { public record DeletePlayListEvent( Guid PlayListId, - Guid UserId); + long UserId); } diff --git a/Application/Events/DeleteTrackEvent.cs b/Application/Events/DeleteTrackEvent.cs index 2f85a6a..8fb6923 100644 --- a/Application/Events/DeleteTrackEvent.cs +++ b/Application/Events/DeleteTrackEvent.cs @@ -2,5 +2,5 @@ namespace Musify.Application.Events { public record DeleteTrackEvent( Guid TrackId, - Guid UserId); + long UserId); } diff --git a/Application/PlayLists/Commands/CreatePlayListCommand.cs b/Application/PlayLists/Commands/CreatePlayListCommand.cs index fa7af4e..95b3788 100644 --- a/Application/PlayLists/Commands/CreatePlayListCommand.cs +++ b/Application/PlayLists/Commands/CreatePlayListCommand.cs @@ -5,7 +5,7 @@ using Musify.Application.PlayLists.Responses; namespace Musify.Application.PlayLists.Commands { public record CreatePlayListCommand( - Guid UserId, + long UserId, string Name, string Description, Guid? PictureIntentId) diff --git a/Application/PlayLists/Commands/DeletePlayListCommand.cs b/Application/PlayLists/Commands/DeletePlayListCommand.cs index c695479..c1860c5 100644 --- a/Application/PlayLists/Commands/DeletePlayListCommand.cs +++ b/Application/PlayLists/Commands/DeletePlayListCommand.cs @@ -3,6 +3,6 @@ using Mediator; namespace Musify.Application.PlayLists.Commands { - public record DeletePlayListCommand(Guid UserId, Guid PlayListId) + public record DeletePlayListCommand(long UserId, Guid PlayListId) : ICommand; } \ No newline at end of file diff --git a/Application/PlayLists/Commands/RequestPlayListPictureUploadCommand.cs b/Application/PlayLists/Commands/RequestPlayListPictureUploadCommand.cs index fc14a80..7f8a827 100644 --- a/Application/PlayLists/Commands/RequestPlayListPictureUploadCommand.cs +++ b/Application/PlayLists/Commands/RequestPlayListPictureUploadCommand.cs @@ -5,7 +5,7 @@ using Musify.Application.PlayLists.Responses; namespace Musify.Application.PlayLists.Commands { public record RequestPlayListPictureUploadCommand( - Guid UserId, + long UserId, string FileType, string ContentType, long? ExpectedSizeBytes = null) diff --git a/Application/PlayLists/Commands/UpdatePlayListCommand.cs b/Application/PlayLists/Commands/UpdatePlayListCommand.cs index f6795c2..a2bfe18 100644 --- a/Application/PlayLists/Commands/UpdatePlayListCommand.cs +++ b/Application/PlayLists/Commands/UpdatePlayListCommand.cs @@ -5,7 +5,7 @@ using Musify.Application.PlayLists.Responses; namespace Musify.Application.PlayLists.Commands { public record UpdatePlayListCommand( - Guid UserId, + long UserId, Guid PlayListId, string? NewName, string? NewDescription, diff --git a/Application/PlayLists/Queries/GetPlayListsByUserIdQuery.cs b/Application/PlayLists/Queries/GetPlayListsByUserIdQuery.cs index c2e9da5..a4a11f5 100644 --- a/Application/PlayLists/Queries/GetPlayListsByUserIdQuery.cs +++ b/Application/PlayLists/Queries/GetPlayListsByUserIdQuery.cs @@ -6,7 +6,7 @@ using Musify.Application.PlayLists.Responses; namespace Musify.Application.PlayLists.Queries { public record GetPlayListsByUserIdQuery( - Guid UserId, + long UserId, string? Name = null, int PageNumber = 1, int PageSize = 10) diff --git a/Application/Services/UploadIntentValidator.cs b/Application/Services/UploadIntentValidator.cs index 380fbb7..c3efaa5 100644 --- a/Application/Services/UploadIntentValidator.cs +++ b/Application/Services/UploadIntentValidator.cs @@ -13,7 +13,7 @@ public sealed class UploadIntentValidator( { public async Task CheckQuotaAsync( UploadIntentConfiguration config, - Guid userId, + long userId, long requiredBytes, int requiredIntentCount, CancellationToken cancellationToken) @@ -36,7 +36,7 @@ public sealed class UploadIntentValidator( public async Task> ValidateAndLoadAsync( UploadIntentConfiguration config, Guid intentId, - Guid userId, + long userId, CancellationToken cancellationToken) { var intent = await database.UploadIntents diff --git a/Application/Tracks/Commands/CreateTrackCommand.cs b/Application/Tracks/Commands/CreateTrackCommand.cs index bda3529..b5fd8a3 100644 --- a/Application/Tracks/Commands/CreateTrackCommand.cs +++ b/Application/Tracks/Commands/CreateTrackCommand.cs @@ -5,7 +5,7 @@ using Musify.Application.Tracks.Responses; namespace Musify.Application.Tracks.Commands { public record CreateTrackCommand( - Guid UserId, + long UserId, string Title, Guid PictureIntentId, Guid AudioIntentId) diff --git a/Application/Tracks/Commands/DeleteTrackCommand.cs b/Application/Tracks/Commands/DeleteTrackCommand.cs index 6d7615f..619869e 100644 --- a/Application/Tracks/Commands/DeleteTrackCommand.cs +++ b/Application/Tracks/Commands/DeleteTrackCommand.cs @@ -4,7 +4,7 @@ using Mediator; namespace Musify.Application.Tracks.Commands { public record DeleteTrackCommand( - Guid UserId, + long UserId, Guid TrackId) : ICommand; } \ No newline at end of file diff --git a/Application/Tracks/Commands/RequestTrackUploadUrlsCommand.cs b/Application/Tracks/Commands/RequestTrackUploadUrlsCommand.cs index 46b7151..ea82fbb 100644 --- a/Application/Tracks/Commands/RequestTrackUploadUrlsCommand.cs +++ b/Application/Tracks/Commands/RequestTrackUploadUrlsCommand.cs @@ -5,7 +5,7 @@ using Musify.Application.Tracks.Responses; namespace Musify.Application.Tracks.Commands { public record RequestTrackUploadUrlsCommand( - Guid UserId, + long UserId, string PictureFileType, string PictureContentType, string AudioFileType, diff --git a/Application/Tracks/Queries/GetTrackStreamQuery.cs b/Application/Tracks/Queries/GetTrackStreamQuery.cs index 66733ad..03286ae 100644 --- a/Application/Tracks/Queries/GetTrackStreamQuery.cs +++ b/Application/Tracks/Queries/GetTrackStreamQuery.cs @@ -4,6 +4,6 @@ using Musify.Application.Tracks.Responses; namespace Musify.Application.Tracks.Queries { - public record GetTrackStreamQuery(Guid TrackId, Guid UserId) + public record GetTrackStreamQuery(Guid TrackId, long UserId) : IQuery>; } diff --git a/Application/Tracks/Queries/GetTracksByUserIdQuery.cs b/Application/Tracks/Queries/GetTracksByUserIdQuery.cs index 00a00f6..6e389dd 100644 --- a/Application/Tracks/Queries/GetTracksByUserIdQuery.cs +++ b/Application/Tracks/Queries/GetTracksByUserIdQuery.cs @@ -6,7 +6,7 @@ using Musify.Application.Tracks.Responses; namespace Musify.Application.Tracks.Queries { public record GetTracksByUserIdQuery( - Guid UserId, + long UserId, string? Name = null, int PageNumber = 1, int PageSize = 10) diff --git a/Application/Users/Commands/CreateUserCommand.cs b/Application/Users/Commands/CreateUserCommand.cs index fef2150..6415e31 100644 --- a/Application/Users/Commands/CreateUserCommand.cs +++ b/Application/Users/Commands/CreateUserCommand.cs @@ -5,7 +5,7 @@ using Musify.Domain.Entities; namespace Musify.Application.Users.Commands { - public record CreateUserCommand(Guid Id, + public record CreateUserCommand(long Id, string Name, string? FirstName, string? SecondName) diff --git a/Application/Users/Queries/GetUserByIdQuery.cs b/Application/Users/Queries/GetUserByIdQuery.cs index d23ead1..f17c5e6 100644 --- a/Application/Users/Queries/GetUserByIdQuery.cs +++ b/Application/Users/Queries/GetUserByIdQuery.cs @@ -4,6 +4,6 @@ using Musify.Application.Users.Responses; namespace Musify.Application.Users.Queries { - public record GetUserByIdQuery(Guid Id) + public record GetUserByIdQuery(long Id) : IQuery >; } \ No newline at end of file diff --git a/Application/Users/Responses/UserApplicationResponse.cs b/Application/Users/Responses/UserApplicationResponse.cs index 2c98ec2..e42616c 100644 --- a/Application/Users/Responses/UserApplicationResponse.cs +++ b/Application/Users/Responses/UserApplicationResponse.cs @@ -3,7 +3,7 @@ namespace Musify.Application.Users.Responses { public record UserApplicationResponse( - Guid Id, + long Id, string Name, string? FirstName, string? SecondName, diff --git a/Domain/Entities/PlayList.cs b/Domain/Entities/PlayList.cs index 6e6c7a8..8789adb 100644 --- a/Domain/Entities/PlayList.cs +++ b/Domain/Entities/PlayList.cs @@ -13,7 +13,7 @@ namespace Musify.Domain.Entities public Guid Id { get; set; } = Guid.NewGuid(); [Required] - public required Guid UserId { get; set; } + public required long UserId { get; set; } [Required] [MaxLength(50)] diff --git a/Domain/Entities/UploadIntent.cs b/Domain/Entities/UploadIntent.cs index 11a44f3..d4f772b 100644 --- a/Domain/Entities/UploadIntent.cs +++ b/Domain/Entities/UploadIntent.cs @@ -12,7 +12,7 @@ namespace Musify.Domain.Entities public Guid Id { get; set; } = Guid.NewGuid(); [Required] - public required Guid UserId { get; set; } + public required long UserId { get; set; } [Required, MaxLength(128)] public required string Bucket { get; set; } diff --git a/Domain/Entities/User.cs b/Domain/Entities/User.cs index c0be246..2d2a0b0 100644 --- a/Domain/Entities/User.cs +++ b/Domain/Entities/User.cs @@ -7,7 +7,8 @@ namespace Musify.Domain.Entities public class User { [Key] - public required Guid Id { get; set; } + [DatabaseGenerated(DatabaseGeneratedOption.None)] + public required long Id { get; set; } [Required] [MaxLength(48)] diff --git a/Domain/Entities/UserHasTrack.cs b/Domain/Entities/UserHasTrack.cs index fbf0d07..f2e72b3 100644 --- a/Domain/Entities/UserHasTrack.cs +++ b/Domain/Entities/UserHasTrack.cs @@ -10,7 +10,7 @@ namespace Musify.Domain.Entities public Guid Id { get; set; } = Guid.NewGuid(); [Required] - public required Guid UserId { get; set; } + public required long UserId { get; set; } [Required] public required Guid TrackId { get; set; } diff --git a/Infrastructure/MassTransit/RoutingSlip/Builders/DeletePlayListRoutingSlipBuilder.cs b/Infrastructure/MassTransit/RoutingSlip/Builders/DeletePlayListRoutingSlipBuilder.cs index efe4837..4390061 100644 --- a/Infrastructure/MassTransit/RoutingSlip/Builders/DeletePlayListRoutingSlipBuilder.cs +++ b/Infrastructure/MassTransit/RoutingSlip/Builders/DeletePlayListRoutingSlipBuilder.cs @@ -17,7 +17,7 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders { public async Task BuildAsync( Guid playListId, - Guid userId, + long userId, Guid? correlationId, CancellationToken cancellationToken) { diff --git a/Infrastructure/MassTransit/RoutingSlip/Builders/DeleteTrackRoutingSlipBuilder.cs b/Infrastructure/MassTransit/RoutingSlip/Builders/DeleteTrackRoutingSlipBuilder.cs index f6ed175..2c6a0f2 100644 --- a/Infrastructure/MassTransit/RoutingSlip/Builders/DeleteTrackRoutingSlipBuilder.cs +++ b/Infrastructure/MassTransit/RoutingSlip/Builders/DeleteTrackRoutingSlipBuilder.cs @@ -17,7 +17,7 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders { public async Task BuildAsync( Guid trackId, - Guid userId, + long userId, Guid? correlationId, CancellationToken cancellationToken) { diff --git a/Infrastructure/Persistence/Migrations/20260513230601_FirstMigration.Designer.cs b/Infrastructure/Persistence/Migrations/20260513230601_FirstMigration.Designer.cs deleted file mode 100644 index 30ca380..0000000 --- a/Infrastructure/Persistence/Migrations/20260513230601_FirstMigration.Designer.cs +++ /dev/null @@ -1,332 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Musify.Infrastructure.Persistence; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Musify.Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(Database))] - [Migration("20260513230601_FirstMigration")] - partial class FirstMigration - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Musify.Domain.Entities.PlayList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("LargePictureName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("MediumPictureName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OriginalPictureName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("SmallPictureName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("UpdatedDate") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("PlayLists"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.PlayListHasTrack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AddedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PlayListId") - .HasColumnType("uuid"); - - b.Property("Position") - .HasColumnType("integer"); - - b.Property("TrackId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("PlayListId"); - - b.HasIndex("TrackId"); - - b.ToTable("PlayListHasTrack"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.Track", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AudioFolderName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("AudioTranscodeProcessingStatus") - .HasColumnType("integer"); - - b.Property("CreatedDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LargePictureName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LastRetryAt") - .HasColumnType("timestamp with time zone"); - - b.Property("MediumPictureName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("NormalizedTitle") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OriginalAudioName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("OriginalPictureName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("PicturesProcessingStatus") - .HasColumnType("integer"); - - b.Property("RetryCount") - .HasColumnType("integer"); - - b.Property("SmallPictureName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedDate") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.ToTable("Tracks"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.Upload", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Bucket") - .IsRequired() - .HasColumnType("text"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Key") - .IsRequired() - .HasColumnType("text"); - - b.Property("State") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.ToTable("Upload"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("FirstName") - .HasMaxLength(48) - .HasColumnType("character varying(48)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(48) - .HasColumnType("character varying(48)"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(48) - .HasColumnType("character varying(48)"); - - b.Property("SecondName") - .HasMaxLength(48) - .HasColumnType("character varying(48)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.ToTable("User"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.UserHasTrack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("TrackId") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TrackId"); - - b.HasIndex("UserId"); - - b.ToTable("UserHasTrack"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.PlayList", b => - { - b.HasOne("Musify.Domain.Entities.User", "User") - .WithMany("PlayLists") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.PlayListHasTrack", b => - { - b.HasOne("Musify.Domain.Entities.PlayList", "PlayList") - .WithMany("PlayListTracks") - .HasForeignKey("PlayListId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Musify.Domain.Entities.Track", "Track") - .WithMany("PlayListTracks") - .HasForeignKey("TrackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PlayList"); - - b.Navigation("Track"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.UserHasTrack", b => - { - b.HasOne("Musify.Domain.Entities.Track", "Track") - .WithMany("UserTracks") - .HasForeignKey("TrackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Musify.Domain.Entities.User", "User") - .WithMany("UserTracks") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Track"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.PlayList", b => - { - b.Navigation("PlayListTracks"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.Track", b => - { - b.Navigation("PlayListTracks"); - - b.Navigation("UserTracks"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.User", b => - { - b.Navigation("PlayLists"); - - b.Navigation("UserTracks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Infrastructure/Persistence/Migrations/20260514095113_AddMassTransitOutbox.Designer.cs b/Infrastructure/Persistence/Migrations/20260514095113_AddMassTransitOutbox.Designer.cs deleted file mode 100644 index ce2d9a3..0000000 --- a/Infrastructure/Persistence/Migrations/20260514095113_AddMassTransitOutbox.Designer.cs +++ /dev/null @@ -1,512 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Musify.Infrastructure.Persistence; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Musify.Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(Database))] - [Migration("20260514095113_AddMassTransitOutbox")] - partial class AddMassTransitOutbox - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MassTransit.EntityFrameworkCoreIntegration.InboxState", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Consumed") - .HasColumnType("timestamp with time zone"); - - b.Property("ConsumerId") - .HasColumnType("uuid"); - - b.Property("Delivered") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpirationTime") - .HasColumnType("timestamp with time zone"); - - b.Property("LastSequenceNumber") - .HasColumnType("bigint"); - - b.Property("LockId") - .HasColumnType("uuid"); - - b.Property("MessageId") - .HasColumnType("uuid"); - - b.Property("ReceiveCount") - .HasColumnType("integer"); - - b.Property("Received") - .HasColumnType("timestamp with time zone"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("bytea"); - - b.HasKey("Id"); - - b.HasIndex("Delivered"); - - b.ToTable("InboxState"); - }); - - modelBuilder.Entity("MassTransit.EntityFrameworkCoreIntegration.OutboxMessage", b => - { - b.Property("SequenceNumber") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceNumber")); - - b.Property("Body") - .IsRequired() - .HasColumnType("text"); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("ConversationId") - .HasColumnType("uuid"); - - b.Property("CorrelationId") - .HasColumnType("uuid"); - - b.Property("DestinationAddress") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("EnqueueTime") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpirationTime") - .HasColumnType("timestamp with time zone"); - - b.Property("FaultAddress") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Headers") - .HasColumnType("text"); - - b.Property("InboxConsumerId") - .HasColumnType("uuid"); - - b.Property("InboxMessageId") - .HasColumnType("uuid"); - - b.Property("InitiatorId") - .HasColumnType("uuid"); - - b.Property("MessageId") - .HasColumnType("uuid"); - - b.Property("MessageType") - .IsRequired() - .HasColumnType("text"); - - b.Property("OutboxId") - .HasColumnType("uuid"); - - b.Property("Properties") - .HasColumnType("text"); - - b.Property("RequestId") - .HasColumnType("uuid"); - - b.Property("ResponseAddress") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("SentTime") - .HasColumnType("timestamp with time zone"); - - b.Property("SourceAddress") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.HasKey("SequenceNumber"); - - b.HasIndex("EnqueueTime"); - - b.HasIndex("ExpirationTime"); - - b.HasIndex("OutboxId", "SequenceNumber") - .IsUnique(); - - b.HasIndex("InboxMessageId", "InboxConsumerId", "SequenceNumber") - .IsUnique(); - - b.ToTable("OutboxMessage"); - }); - - modelBuilder.Entity("MassTransit.EntityFrameworkCoreIntegration.OutboxState", b => - { - b.Property("OutboxId") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Created") - .HasColumnType("timestamp with time zone"); - - b.Property("Delivered") - .HasColumnType("timestamp with time zone"); - - b.Property("LastSequenceNumber") - .HasColumnType("bigint"); - - b.Property("LockId") - .HasColumnType("uuid"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("bytea"); - - b.HasKey("OutboxId"); - - b.HasIndex("Created"); - - b.ToTable("OutboxState"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.PlayList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("LargePictureName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("MediumPictureName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OriginalPictureName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("SmallPictureName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("UpdatedDate") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("PlayLists"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.PlayListHasTrack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AddedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PlayListId") - .HasColumnType("uuid"); - - b.Property("Position") - .HasColumnType("integer"); - - b.Property("TrackId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("PlayListId"); - - b.HasIndex("TrackId"); - - b.ToTable("PlayListHasTrack"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.Track", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AudioFolderName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("AudioTranscodeProcessingStatus") - .HasColumnType("integer"); - - b.Property("CreatedDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LargePictureName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LastRetryAt") - .HasColumnType("timestamp with time zone"); - - b.Property("MediumPictureName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("NormalizedTitle") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OriginalAudioName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("OriginalPictureName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("PicturesProcessingStatus") - .HasColumnType("integer"); - - b.Property("RetryCount") - .HasColumnType("integer"); - - b.Property("SmallPictureName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedDate") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.ToTable("Tracks"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.Upload", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Bucket") - .IsRequired() - .HasColumnType("text"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Key") - .IsRequired() - .HasColumnType("text"); - - b.Property("State") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.ToTable("Upload"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("FirstName") - .HasMaxLength(48) - .HasColumnType("character varying(48)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(48) - .HasColumnType("character varying(48)"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(48) - .HasColumnType("character varying(48)"); - - b.Property("SecondName") - .HasMaxLength(48) - .HasColumnType("character varying(48)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.ToTable("User"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.UserHasTrack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("TrackId") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TrackId"); - - b.HasIndex("UserId"); - - b.ToTable("UserHasTrack"); - }); - - modelBuilder.Entity("MassTransit.EntityFrameworkCoreIntegration.OutboxMessage", b => - { - b.HasOne("MassTransit.EntityFrameworkCoreIntegration.OutboxState", null) - .WithMany() - .HasForeignKey("OutboxId"); - - b.HasOne("MassTransit.EntityFrameworkCoreIntegration.InboxState", null) - .WithMany() - .HasForeignKey("InboxMessageId", "InboxConsumerId") - .HasPrincipalKey("MessageId", "ConsumerId"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.PlayList", b => - { - b.HasOne("Musify.Domain.Entities.User", "User") - .WithMany("PlayLists") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.PlayListHasTrack", b => - { - b.HasOne("Musify.Domain.Entities.PlayList", "PlayList") - .WithMany("PlayListTracks") - .HasForeignKey("PlayListId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Musify.Domain.Entities.Track", "Track") - .WithMany("PlayListTracks") - .HasForeignKey("TrackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PlayList"); - - b.Navigation("Track"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.UserHasTrack", b => - { - b.HasOne("Musify.Domain.Entities.Track", "Track") - .WithMany("UserTracks") - .HasForeignKey("TrackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Musify.Domain.Entities.User", "User") - .WithMany("UserTracks") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Track"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.PlayList", b => - { - b.Navigation("PlayListTracks"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.Track", b => - { - b.Navigation("PlayListTracks"); - - b.Navigation("UserTracks"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.User", b => - { - b.Navigation("PlayLists"); - - b.Navigation("UserTracks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Infrastructure/Persistence/Migrations/20260514095113_AddMassTransitOutbox.cs b/Infrastructure/Persistence/Migrations/20260514095113_AddMassTransitOutbox.cs deleted file mode 100644 index c4074bd..0000000 --- a/Infrastructure/Persistence/Migrations/20260514095113_AddMassTransitOutbox.cs +++ /dev/null @@ -1,142 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Musify.Infrastructure.Persistence.Migrations -{ - /// - public partial class AddMassTransitOutbox : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "InboxState", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - MessageId = table.Column(type: "uuid", nullable: false), - ConsumerId = table.Column(type: "uuid", nullable: false), - LockId = table.Column(type: "uuid", nullable: false), - RowVersion = table.Column(type: "bytea", rowVersion: true, nullable: true), - Received = table.Column(type: "timestamp with time zone", nullable: false), - ReceiveCount = table.Column(type: "integer", nullable: false), - ExpirationTime = table.Column(type: "timestamp with time zone", nullable: true), - Consumed = table.Column(type: "timestamp with time zone", nullable: true), - Delivered = table.Column(type: "timestamp with time zone", nullable: true), - LastSequenceNumber = table.Column(type: "bigint", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_InboxState", x => x.Id); - table.UniqueConstraint("AK_InboxState_MessageId_ConsumerId", x => new { x.MessageId, x.ConsumerId }); - }); - - migrationBuilder.CreateTable( - name: "OutboxState", - columns: table => new - { - OutboxId = table.Column(type: "uuid", nullable: false), - LockId = table.Column(type: "uuid", nullable: false), - RowVersion = table.Column(type: "bytea", rowVersion: true, nullable: true), - Created = table.Column(type: "timestamp with time zone", nullable: false), - Delivered = table.Column(type: "timestamp with time zone", nullable: true), - LastSequenceNumber = table.Column(type: "bigint", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_OutboxState", x => x.OutboxId); - }); - - migrationBuilder.CreateTable( - name: "OutboxMessage", - columns: table => new - { - SequenceNumber = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EnqueueTime = table.Column(type: "timestamp with time zone", nullable: true), - SentTime = table.Column(type: "timestamp with time zone", nullable: false), - Headers = table.Column(type: "text", nullable: true), - Properties = table.Column(type: "text", nullable: true), - InboxMessageId = table.Column(type: "uuid", nullable: true), - InboxConsumerId = table.Column(type: "uuid", nullable: true), - OutboxId = table.Column(type: "uuid", nullable: true), - MessageId = table.Column(type: "uuid", nullable: false), - ContentType = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), - MessageType = table.Column(type: "text", nullable: false), - Body = table.Column(type: "text", nullable: false), - ConversationId = table.Column(type: "uuid", nullable: true), - CorrelationId = table.Column(type: "uuid", nullable: true), - InitiatorId = table.Column(type: "uuid", nullable: true), - RequestId = table.Column(type: "uuid", nullable: true), - SourceAddress = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - DestinationAddress = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - ResponseAddress = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - FaultAddress = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - ExpirationTime = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_OutboxMessage", x => x.SequenceNumber); - table.ForeignKey( - name: "FK_OutboxMessage_InboxState_InboxMessageId_InboxConsumerId", - columns: x => new { x.InboxMessageId, x.InboxConsumerId }, - principalTable: "InboxState", - principalColumns: new[] { "MessageId", "ConsumerId" }); - table.ForeignKey( - name: "FK_OutboxMessage_OutboxState_OutboxId", - column: x => x.OutboxId, - principalTable: "OutboxState", - principalColumn: "OutboxId"); - }); - - migrationBuilder.CreateIndex( - name: "IX_InboxState_Delivered", - table: "InboxState", - column: "Delivered"); - - migrationBuilder.CreateIndex( - name: "IX_OutboxMessage_EnqueueTime", - table: "OutboxMessage", - column: "EnqueueTime"); - - migrationBuilder.CreateIndex( - name: "IX_OutboxMessage_ExpirationTime", - table: "OutboxMessage", - column: "ExpirationTime"); - - migrationBuilder.CreateIndex( - name: "IX_OutboxMessage_InboxMessageId_InboxConsumerId_SequenceNumber", - table: "OutboxMessage", - columns: new[] { "InboxMessageId", "InboxConsumerId", "SequenceNumber" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_OutboxMessage_OutboxId_SequenceNumber", - table: "OutboxMessage", - columns: new[] { "OutboxId", "SequenceNumber" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_OutboxState_Created", - table: "OutboxState", - column: "Created"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "OutboxMessage"); - - migrationBuilder.DropTable( - name: "InboxState"); - - migrationBuilder.DropTable( - name: "OutboxState"); - } - } -} diff --git a/Infrastructure/Persistence/Migrations/20260514161518_AddLifeCycleStatus.Designer.cs b/Infrastructure/Persistence/Migrations/20260514161518_AddLifeCycleStatus.Designer.cs deleted file mode 100644 index 98c3d87..0000000 --- a/Infrastructure/Persistence/Migrations/20260514161518_AddLifeCycleStatus.Designer.cs +++ /dev/null @@ -1,518 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Musify.Infrastructure.Persistence; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Musify.Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(Database))] - [Migration("20260514161518_AddLifeCycleStatus")] - partial class AddLifeCycleStatus - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("MassTransit.EntityFrameworkCoreIntegration.InboxState", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Consumed") - .HasColumnType("timestamp with time zone"); - - b.Property("ConsumerId") - .HasColumnType("uuid"); - - b.Property("Delivered") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpirationTime") - .HasColumnType("timestamp with time zone"); - - b.Property("LastSequenceNumber") - .HasColumnType("bigint"); - - b.Property("LockId") - .HasColumnType("uuid"); - - b.Property("MessageId") - .HasColumnType("uuid"); - - b.Property("ReceiveCount") - .HasColumnType("integer"); - - b.Property("Received") - .HasColumnType("timestamp with time zone"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("bytea"); - - b.HasKey("Id"); - - b.HasIndex("Delivered"); - - b.ToTable("InboxState"); - }); - - modelBuilder.Entity("MassTransit.EntityFrameworkCoreIntegration.OutboxMessage", b => - { - b.Property("SequenceNumber") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceNumber")); - - b.Property("Body") - .IsRequired() - .HasColumnType("text"); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("ConversationId") - .HasColumnType("uuid"); - - b.Property("CorrelationId") - .HasColumnType("uuid"); - - b.Property("DestinationAddress") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("EnqueueTime") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpirationTime") - .HasColumnType("timestamp with time zone"); - - b.Property("FaultAddress") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("Headers") - .HasColumnType("text"); - - b.Property("InboxConsumerId") - .HasColumnType("uuid"); - - b.Property("InboxMessageId") - .HasColumnType("uuid"); - - b.Property("InitiatorId") - .HasColumnType("uuid"); - - b.Property("MessageId") - .HasColumnType("uuid"); - - b.Property("MessageType") - .IsRequired() - .HasColumnType("text"); - - b.Property("OutboxId") - .HasColumnType("uuid"); - - b.Property("Properties") - .HasColumnType("text"); - - b.Property("RequestId") - .HasColumnType("uuid"); - - b.Property("ResponseAddress") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("SentTime") - .HasColumnType("timestamp with time zone"); - - b.Property("SourceAddress") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.HasKey("SequenceNumber"); - - b.HasIndex("EnqueueTime"); - - b.HasIndex("ExpirationTime"); - - b.HasIndex("OutboxId", "SequenceNumber") - .IsUnique(); - - b.HasIndex("InboxMessageId", "InboxConsumerId", "SequenceNumber") - .IsUnique(); - - b.ToTable("OutboxMessage"); - }); - - modelBuilder.Entity("MassTransit.EntityFrameworkCoreIntegration.OutboxState", b => - { - b.Property("OutboxId") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Created") - .HasColumnType("timestamp with time zone"); - - b.Property("Delivered") - .HasColumnType("timestamp with time zone"); - - b.Property("LastSequenceNumber") - .HasColumnType("bigint"); - - b.Property("LockId") - .HasColumnType("uuid"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("bytea"); - - b.HasKey("OutboxId"); - - b.HasIndex("Created"); - - b.ToTable("OutboxState"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.PlayList", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("LargePictureName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LifeCycleStatus") - .HasColumnType("integer"); - - b.Property("MediumPictureName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OriginalPictureName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("SmallPictureName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("UpdatedDate") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("PlayLists"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.PlayListHasTrack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AddedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PlayListId") - .HasColumnType("uuid"); - - b.Property("Position") - .HasColumnType("integer"); - - b.Property("TrackId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("PlayListId"); - - b.HasIndex("TrackId"); - - b.ToTable("PlayListHasTrack"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.Track", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AudioFolderName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("AudioTranscodeProcessingStatus") - .HasColumnType("integer"); - - b.Property("CreatedDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LargePictureName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LastRetryAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LifeCycleStatus") - .HasColumnType("integer"); - - b.Property("MediumPictureName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("NormalizedTitle") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OriginalAudioName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("OriginalPictureName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("PicturesProcessingStatus") - .HasColumnType("integer"); - - b.Property("RetryCount") - .HasColumnType("integer"); - - b.Property("SmallPictureName") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedDate") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.ToTable("Tracks"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.Upload", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Bucket") - .IsRequired() - .HasColumnType("text"); - - b.Property("ContentType") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Key") - .IsRequired() - .HasColumnType("text"); - - b.Property("State") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.ToTable("Upload"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("FirstName") - .HasMaxLength(48) - .HasColumnType("character varying(48)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(48) - .HasColumnType("character varying(48)"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(48) - .HasColumnType("character varying(48)"); - - b.Property("SecondName") - .HasMaxLength(48) - .HasColumnType("character varying(48)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.ToTable("User"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.UserHasTrack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("TrackId") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TrackId"); - - b.HasIndex("UserId"); - - b.ToTable("UserHasTrack"); - }); - - modelBuilder.Entity("MassTransit.EntityFrameworkCoreIntegration.OutboxMessage", b => - { - b.HasOne("MassTransit.EntityFrameworkCoreIntegration.OutboxState", null) - .WithMany() - .HasForeignKey("OutboxId"); - - b.HasOne("MassTransit.EntityFrameworkCoreIntegration.InboxState", null) - .WithMany() - .HasForeignKey("InboxMessageId", "InboxConsumerId") - .HasPrincipalKey("MessageId", "ConsumerId"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.PlayList", b => - { - b.HasOne("Musify.Domain.Entities.User", "User") - .WithMany("PlayLists") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.PlayListHasTrack", b => - { - b.HasOne("Musify.Domain.Entities.PlayList", "PlayList") - .WithMany("PlayListTracks") - .HasForeignKey("PlayListId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Musify.Domain.Entities.Track", "Track") - .WithMany("PlayListTracks") - .HasForeignKey("TrackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PlayList"); - - b.Navigation("Track"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.UserHasTrack", b => - { - b.HasOne("Musify.Domain.Entities.Track", "Track") - .WithMany("UserTracks") - .HasForeignKey("TrackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Musify.Domain.Entities.User", "User") - .WithMany("UserTracks") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Track"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.PlayList", b => - { - b.Navigation("PlayListTracks"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.Track", b => - { - b.Navigation("PlayListTracks"); - - b.Navigation("UserTracks"); - }); - - modelBuilder.Entity("Musify.Domain.Entities.User", b => - { - b.Navigation("PlayLists"); - - b.Navigation("UserTracks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Infrastructure/Persistence/Migrations/20260514161518_AddLifeCycleStatus.cs b/Infrastructure/Persistence/Migrations/20260514161518_AddLifeCycleStatus.cs deleted file mode 100644 index 68a1b0c..0000000 --- a/Infrastructure/Persistence/Migrations/20260514161518_AddLifeCycleStatus.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Musify.Infrastructure.Persistence.Migrations -{ - /// - public partial class AddLifeCycleStatus : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "LifeCycleStatus", - table: "Tracks", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "LifeCycleStatus", - table: "PlayLists", - type: "integer", - nullable: false, - defaultValue: 0); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "LifeCycleStatus", - table: "Tracks"); - - migrationBuilder.DropColumn( - name: "LifeCycleStatus", - table: "PlayLists"); - } - } -} diff --git a/Infrastructure/Persistence/Migrations/20260514172047_AddUploadIntentTable.cs b/Infrastructure/Persistence/Migrations/20260514172047_AddUploadIntentTable.cs deleted file mode 100644 index 6d39875..0000000 --- a/Infrastructure/Persistence/Migrations/20260514172047_AddUploadIntentTable.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Musify.Infrastructure.Persistence.Migrations -{ - /// - public partial class AddUploadIntentTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "UploadIntents", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - Bucket = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - Key = table.Column(type: "character varying(512)", maxLength: 512, nullable: false), - ObjectName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - ContentType = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - ExpectedSizeBytes = table.Column(type: "bigint", nullable: true), - Purpose = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "integer", nullable: false), - ExpiresAt = table.Column(type: "timestamp with time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_UploadIntents", x => x.Id); - table.ForeignKey( - name: "FK_UploadIntents_User_UserId", - column: x => x.UserId, - principalTable: "User", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_UploadIntents_UserId", - table: "UploadIntents", - column: "UserId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "UploadIntents"); - } - } -} diff --git a/Infrastructure/Persistence/Migrations/20260514172047_AddUploadIntentTable.Designer.cs b/Infrastructure/Persistence/Migrations/20260530020027_InitialCreate.Designer.cs similarity index 97% rename from Infrastructure/Persistence/Migrations/20260514172047_AddUploadIntentTable.Designer.cs rename to Infrastructure/Persistence/Migrations/20260530020027_InitialCreate.Designer.cs index a27e8d3..1b193c6 100644 --- a/Infrastructure/Persistence/Migrations/20260514172047_AddUploadIntentTable.Designer.cs +++ b/Infrastructure/Persistence/Migrations/20260530020027_InitialCreate.Designer.cs @@ -12,15 +12,15 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace Musify.Infrastructure.Persistence.Migrations { [DbContext(typeof(Database))] - [Migration("20260514172047_AddUploadIntentTable")] - partial class AddUploadIntentTable + [Migration("20260530020027_InitialCreate")] + partial class InitialCreate { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") + .HasAnnotation("ProductVersion", "10.0.8") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -243,8 +243,8 @@ namespace Musify.Infrastructure.Persistence.Migrations b.Property("UpdatedDate") .HasColumnType("timestamp with time zone"); - b.Property("UserId") - .HasColumnType("uuid"); + b.Property("UserId") + .HasColumnType("bigint"); b.HasKey("Id"); @@ -418,8 +418,8 @@ namespace Musify.Infrastructure.Persistence.Migrations b.Property("Status") .HasColumnType("integer"); - b.Property("UserId") - .HasColumnType("uuid"); + b.Property("UserId") + .HasColumnType("bigint"); b.HasKey("Id"); @@ -430,9 +430,8 @@ namespace Musify.Infrastructure.Persistence.Migrations modelBuilder.Entity("Musify.Domain.Entities.User", b => { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); + b.Property("Id") + .HasColumnType("bigint"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); @@ -472,8 +471,8 @@ namespace Musify.Infrastructure.Persistence.Migrations b.Property("TrackId") .HasColumnType("uuid"); - b.Property("UserId") - .HasColumnType("uuid"); + b.Property("UserId") + .HasColumnType("bigint"); b.HasKey("Id"); diff --git a/Infrastructure/Persistence/Migrations/20260513230601_FirstMigration.cs b/Infrastructure/Persistence/Migrations/20260530020027_InitialCreate.cs similarity index 50% rename from Infrastructure/Persistence/Migrations/20260513230601_FirstMigration.cs rename to Infrastructure/Persistence/Migrations/20260530020027_InitialCreate.cs index 17e8882..ffa9382 100644 --- a/Infrastructure/Persistence/Migrations/20260513230601_FirstMigration.cs +++ b/Infrastructure/Persistence/Migrations/20260530020027_InitialCreate.cs @@ -1,16 +1,56 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace Musify.Infrastructure.Persistence.Migrations { /// - public partial class FirstMigration : Migration + public partial class InitialCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { + migrationBuilder.CreateTable( + name: "InboxState", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + MessageId = table.Column(type: "uuid", nullable: false), + ConsumerId = table.Column(type: "uuid", nullable: false), + LockId = table.Column(type: "uuid", nullable: false), + RowVersion = table.Column(type: "bytea", rowVersion: true, nullable: true), + Received = table.Column(type: "timestamp with time zone", nullable: false), + ReceiveCount = table.Column(type: "integer", nullable: false), + ExpirationTime = table.Column(type: "timestamp with time zone", nullable: true), + Consumed = table.Column(type: "timestamp with time zone", nullable: true), + Delivered = table.Column(type: "timestamp with time zone", nullable: true), + LastSequenceNumber = table.Column(type: "bigint", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_InboxState", x => x.Id); + table.UniqueConstraint("AK_InboxState_MessageId_ConsumerId", x => new { x.MessageId, x.ConsumerId }); + }); + + migrationBuilder.CreateTable( + name: "OutboxState", + columns: table => new + { + OutboxId = table.Column(type: "uuid", nullable: false), + LockId = table.Column(type: "uuid", nullable: false), + RowVersion = table.Column(type: "bytea", rowVersion: true, nullable: true), + Created = table.Column(type: "timestamp with time zone", nullable: false), + Delivered = table.Column(type: "timestamp with time zone", nullable: true), + LastSequenceNumber = table.Column(type: "bigint", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_OutboxState", x => x.OutboxId); + }); + migrationBuilder.CreateTable( name: "Tracks", columns: table => new @@ -26,6 +66,7 @@ namespace Musify.Infrastructure.Persistence.Migrations AudioFolderName = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), PicturesProcessingStatus = table.Column(type: "integer", nullable: false), AudioTranscodeProcessingStatus = table.Column(type: "integer", nullable: false), + LifeCycleStatus = table.Column(type: "integer", nullable: false), RetryCount = table.Column(type: "integer", nullable: false), LastRetryAt = table.Column(type: "timestamp with time zone", nullable: true), CreatedDate = table.Column(type: "timestamp with time zone", nullable: false), @@ -56,7 +97,7 @@ namespace Musify.Infrastructure.Persistence.Migrations name: "User", columns: table => new { - Id = table.Column(type: "uuid", nullable: false), + Id = table.Column(type: "bigint", nullable: false), Name = table.Column(type: "character varying(48)", maxLength: 48, nullable: false), NormalizedName = table.Column(type: "character varying(48)", maxLength: 48, nullable: false), FirstName = table.Column(type: "character varying(48)", maxLength: 48, nullable: true), @@ -69,12 +110,54 @@ namespace Musify.Infrastructure.Persistence.Migrations table.PrimaryKey("PK_User", x => x.Id); }); + migrationBuilder.CreateTable( + name: "OutboxMessage", + columns: table => new + { + SequenceNumber = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + EnqueueTime = table.Column(type: "timestamp with time zone", nullable: true), + SentTime = table.Column(type: "timestamp with time zone", nullable: false), + Headers = table.Column(type: "text", nullable: true), + Properties = table.Column(type: "text", nullable: true), + InboxMessageId = table.Column(type: "uuid", nullable: true), + InboxConsumerId = table.Column(type: "uuid", nullable: true), + OutboxId = table.Column(type: "uuid", nullable: true), + MessageId = table.Column(type: "uuid", nullable: false), + ContentType = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), + MessageType = table.Column(type: "text", nullable: false), + Body = table.Column(type: "text", nullable: false), + ConversationId = table.Column(type: "uuid", nullable: true), + CorrelationId = table.Column(type: "uuid", nullable: true), + InitiatorId = table.Column(type: "uuid", nullable: true), + RequestId = table.Column(type: "uuid", nullable: true), + SourceAddress = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + DestinationAddress = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + ResponseAddress = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + FaultAddress = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + ExpirationTime = table.Column(type: "timestamp with time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_OutboxMessage", x => x.SequenceNumber); + table.ForeignKey( + name: "FK_OutboxMessage_InboxState_InboxMessageId_InboxConsumerId", + columns: x => new { x.InboxMessageId, x.InboxConsumerId }, + principalTable: "InboxState", + principalColumns: new[] { "MessageId", "ConsumerId" }); + table.ForeignKey( + name: "FK_OutboxMessage_OutboxState_OutboxId", + column: x => x.OutboxId, + principalTable: "OutboxState", + principalColumn: "OutboxId"); + }); + migrationBuilder.CreateTable( name: "PlayLists", columns: table => new { Id = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), + UserId = table.Column(type: "bigint", nullable: false), Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), NormalizedName = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), Description = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), @@ -82,6 +165,7 @@ namespace Musify.Infrastructure.Persistence.Migrations SmallPictureName = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), MediumPictureName = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), LargePictureName = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), + LifeCycleStatus = table.Column(type: "integer", nullable: false), CreatedDate = table.Column(type: "timestamp with time zone", nullable: false), UpdatedDate = table.Column(type: "timestamp with time zone", nullable: false) }, @@ -96,12 +180,39 @@ namespace Musify.Infrastructure.Persistence.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "UploadIntents", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + UserId = table.Column(type: "bigint", nullable: false), + Bucket = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), + Key = table.Column(type: "character varying(512)", maxLength: 512, nullable: false), + ObjectName = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), + ContentType = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), + ExpectedSizeBytes = table.Column(type: "bigint", nullable: true), + Purpose = table.Column(type: "integer", nullable: false), + Status = table.Column(type: "integer", nullable: false), + ExpiresAt = table.Column(type: "timestamp with time zone", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UploadIntents", x => x.Id); + table.ForeignKey( + name: "FK_UploadIntents_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "UserHasTrack", columns: table => new { Id = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), + UserId = table.Column(type: "bigint", nullable: false), TrackId = table.Column(type: "uuid", nullable: false) }, constraints: table => @@ -148,6 +259,38 @@ namespace Musify.Infrastructure.Persistence.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateIndex( + name: "IX_InboxState_Delivered", + table: "InboxState", + column: "Delivered"); + + migrationBuilder.CreateIndex( + name: "IX_OutboxMessage_EnqueueTime", + table: "OutboxMessage", + column: "EnqueueTime"); + + migrationBuilder.CreateIndex( + name: "IX_OutboxMessage_ExpirationTime", + table: "OutboxMessage", + column: "ExpirationTime"); + + migrationBuilder.CreateIndex( + name: "IX_OutboxMessage_InboxMessageId_InboxConsumerId_SequenceNumber", + table: "OutboxMessage", + columns: new[] { "InboxMessageId", "InboxConsumerId", "SequenceNumber" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_OutboxMessage_OutboxId_SequenceNumber", + table: "OutboxMessage", + columns: new[] { "OutboxId", "SequenceNumber" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_OutboxState_Created", + table: "OutboxState", + column: "Created"); + migrationBuilder.CreateIndex( name: "IX_PlayListHasTrack_PlayListId", table: "PlayListHasTrack", @@ -163,6 +306,11 @@ namespace Musify.Infrastructure.Persistence.Migrations table: "PlayLists", column: "UserId"); + migrationBuilder.CreateIndex( + name: "IX_UploadIntents_UserId", + table: "UploadIntents", + column: "UserId"); + migrationBuilder.CreateIndex( name: "IX_UserHasTrack_TrackId", table: "UserHasTrack", @@ -177,15 +325,27 @@ namespace Musify.Infrastructure.Persistence.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { + migrationBuilder.DropTable( + name: "OutboxMessage"); + migrationBuilder.DropTable( name: "PlayListHasTrack"); migrationBuilder.DropTable( name: "Upload"); + migrationBuilder.DropTable( + name: "UploadIntents"); + migrationBuilder.DropTable( name: "UserHasTrack"); + migrationBuilder.DropTable( + name: "InboxState"); + + migrationBuilder.DropTable( + name: "OutboxState"); + migrationBuilder.DropTable( name: "PlayLists"); diff --git a/Infrastructure/Persistence/Migrations/DatabaseModelSnapshot.cs b/Infrastructure/Persistence/Migrations/DatabaseModelSnapshot.cs index 292cfc5..3293df5 100644 --- a/Infrastructure/Persistence/Migrations/DatabaseModelSnapshot.cs +++ b/Infrastructure/Persistence/Migrations/DatabaseModelSnapshot.cs @@ -17,7 +17,7 @@ namespace Musify.Infrastructure.Persistence.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") + .HasAnnotation("ProductVersion", "10.0.8") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -240,8 +240,8 @@ namespace Musify.Infrastructure.Persistence.Migrations b.Property("UpdatedDate") .HasColumnType("timestamp with time zone"); - b.Property("UserId") - .HasColumnType("uuid"); + b.Property("UserId") + .HasColumnType("bigint"); b.HasKey("Id"); @@ -415,8 +415,8 @@ namespace Musify.Infrastructure.Persistence.Migrations b.Property("Status") .HasColumnType("integer"); - b.Property("UserId") - .HasColumnType("uuid"); + b.Property("UserId") + .HasColumnType("bigint"); b.HasKey("Id"); @@ -427,9 +427,8 @@ namespace Musify.Infrastructure.Persistence.Migrations modelBuilder.Entity("Musify.Domain.Entities.User", b => { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); + b.Property("Id") + .HasColumnType("bigint"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); @@ -469,8 +468,8 @@ namespace Musify.Infrastructure.Persistence.Migrations b.Property("TrackId") .HasColumnType("uuid"); - b.Property("UserId") - .HasColumnType("uuid"); + b.Property("UserId") + .HasColumnType("bigint"); b.HasKey("Id"); diff --git a/Infrastructure/Services/StreamTicketService.cs b/Infrastructure/Services/StreamTicketService.cs index 2938ed4..10f26d4 100644 --- a/Infrastructure/Services/StreamTicketService.cs +++ b/Infrastructure/Services/StreamTicketService.cs @@ -24,7 +24,7 @@ namespace Musify.Infrastructure.Services signingCredentials = new SigningCredentials(key, SecurityAlgorithms.RsaSha256); } - public StreamTicket IssueTicket(Guid userId, string keyPrefix) + public StreamTicket IssueTicket(long userId, string keyPrefix) { var now = DateTimeOffset.UtcNow;