Latest migration including latest changes

This commit is contained in:
Veljko Tosic
2026-02-10 13:37:11 +01:00
parent 6317d26496
commit 29639be77f
3 changed files with 633 additions and 2 deletions

View File

@@ -0,0 +1,246 @@
// <auto-generated />
using System;
using AipsCore.Infrastructure.Persistence.Db;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace AipsCore.Infrastructure.Persistence.Db.Migrations
{
[DbContext(typeof(AipsDbContext))]
[Migration("20260210123114_AddedShapesAndMemberships")]
partial class AddedShapesAndMemberships
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.Shape.Shape", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("AuthorId")
.HasColumnType("uuid");
b.Property<string>("Color")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<int?>("EndPositionX")
.HasColumnType("integer");
b.Property<int?>("EndPositionY")
.HasColumnType("integer");
b.Property<int>("PositionX")
.HasColumnType("integer");
b.Property<int>("PositionY")
.HasColumnType("integer");
b.Property<int?>("TextSize")
.HasColumnType("integer");
b.Property<string>("TextValue")
.HasColumnType("text");
b.Property<int?>("Thickness")
.HasColumnType("integer");
b.Property<int>("Type")
.HasColumnType("integer");
b.Property<Guid>("WhiteboardId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("AuthorId");
b.HasIndex("WhiteboardId");
b.ToTable("Shapes");
});
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.User.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.Whiteboard.Whiteboard", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("character varying(8)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property<int>("JoinPolicy")
.HasColumnType("integer");
b.Property<int>("MaxParticipants")
.HasColumnType("integer");
b.Property<Guid>("OwnerId")
.HasColumnType("uuid");
b.Property<int>("State")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.HasKey("Id");
b.HasIndex("OwnerId");
b.ToTable("Whiteboards");
});
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.WhiteboardMembership.WhiteboardMembership", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<bool>("CanJoin")
.HasColumnType("boolean");
b.Property<bool>("EditingEnabled")
.HasColumnType("boolean");
b.Property<bool>("IsBanned")
.HasColumnType("boolean");
b.Property<DateTime>("LastInteractedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<Guid>("WhiteboardId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("WhiteboardId");
b.ToTable("WhiteboardMemberships");
});
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.Shape.Shape", b =>
{
b.HasOne("AipsCore.Infrastructure.Persistence.User.User", "Author")
.WithMany("Shapes")
.HasForeignKey("AuthorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AipsCore.Infrastructure.Persistence.Whiteboard.Whiteboard", "Whiteboard")
.WithMany("Shapes")
.HasForeignKey("WhiteboardId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
b.Navigation("Whiteboard");
});
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.Whiteboard.Whiteboard", b =>
{
b.HasOne("AipsCore.Infrastructure.Persistence.User.User", "Owner")
.WithMany("Whiteboards")
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Owner");
});
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.WhiteboardMembership.WhiteboardMembership", b =>
{
b.HasOne("AipsCore.Infrastructure.Persistence.User.User", "User")
.WithMany("Memberships")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AipsCore.Infrastructure.Persistence.Whiteboard.Whiteboard", "Whiteboard")
.WithMany("Memberships")
.HasForeignKey("WhiteboardId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
b.Navigation("Whiteboard");
});
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.User.User", b =>
{
b.Navigation("Memberships");
b.Navigation("Shapes");
b.Navigation("Whiteboards");
});
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.Whiteboard.Whiteboard", b =>
{
b.Navigation("Memberships");
b.Navigation("Shapes");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,214 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AipsCore.Infrastructure.Persistence.Db.Migrations
{
/// <inheritdoc />
public partial class AddedShapesAndMemberships : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "WhiteboardOwnerId",
table: "Whiteboards",
newName: "OwnerId");
migrationBuilder.AddColumn<DateTime>(
name: "CreatedAt",
table: "Whiteboards",
type: "timestamp with time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "DeletedAt",
table: "Whiteboards",
type: "timestamp with time zone",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "JoinPolicy",
table: "Whiteboards",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "MaxParticipants",
table: "Whiteboards",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "State",
table: "Whiteboards",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<DateTime>(
name: "CreatedAt",
table: "Users",
type: "timestamp with time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "DeletedAt",
table: "Users",
type: "timestamp with time zone",
nullable: true);
migrationBuilder.CreateTable(
name: "Shapes",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
WhiteboardId = table.Column<Guid>(type: "uuid", nullable: false),
AuthorId = table.Column<Guid>(type: "uuid", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
PositionX = table.Column<int>(type: "integer", nullable: false),
PositionY = table.Column<int>(type: "integer", nullable: false),
Color = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
EndPositionX = table.Column<int>(type: "integer", nullable: true),
EndPositionY = table.Column<int>(type: "integer", nullable: true),
Thickness = table.Column<int>(type: "integer", nullable: true),
TextValue = table.Column<string>(type: "text", nullable: true),
TextSize = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Shapes", x => x.Id);
table.ForeignKey(
name: "FK_Shapes_Users_AuthorId",
column: x => x.AuthorId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Shapes_Whiteboards_WhiteboardId",
column: x => x.WhiteboardId,
principalTable: "Whiteboards",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "WhiteboardMemberships",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
WhiteboardId = table.Column<Guid>(type: "uuid", nullable: false),
UserId = table.Column<Guid>(type: "uuid", nullable: false),
IsBanned = table.Column<bool>(type: "boolean", nullable: false),
EditingEnabled = table.Column<bool>(type: "boolean", nullable: false),
CanJoin = table.Column<bool>(type: "boolean", nullable: false),
LastInteractedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_WhiteboardMemberships", x => x.Id);
table.ForeignKey(
name: "FK_WhiteboardMemberships_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_WhiteboardMemberships_Whiteboards_WhiteboardId",
column: x => x.WhiteboardId,
principalTable: "Whiteboards",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Whiteboards_OwnerId",
table: "Whiteboards",
column: "OwnerId");
migrationBuilder.CreateIndex(
name: "IX_Shapes_AuthorId",
table: "Shapes",
column: "AuthorId");
migrationBuilder.CreateIndex(
name: "IX_Shapes_WhiteboardId",
table: "Shapes",
column: "WhiteboardId");
migrationBuilder.CreateIndex(
name: "IX_WhiteboardMemberships_UserId",
table: "WhiteboardMemberships",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_WhiteboardMemberships_WhiteboardId",
table: "WhiteboardMemberships",
column: "WhiteboardId");
migrationBuilder.AddForeignKey(
name: "FK_Whiteboards_Users_OwnerId",
table: "Whiteboards",
column: "OwnerId",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Whiteboards_Users_OwnerId",
table: "Whiteboards");
migrationBuilder.DropTable(
name: "Shapes");
migrationBuilder.DropTable(
name: "WhiteboardMemberships");
migrationBuilder.DropIndex(
name: "IX_Whiteboards_OwnerId",
table: "Whiteboards");
migrationBuilder.DropColumn(
name: "CreatedAt",
table: "Whiteboards");
migrationBuilder.DropColumn(
name: "DeletedAt",
table: "Whiteboards");
migrationBuilder.DropColumn(
name: "JoinPolicy",
table: "Whiteboards");
migrationBuilder.DropColumn(
name: "MaxParticipants",
table: "Whiteboards");
migrationBuilder.DropColumn(
name: "State",
table: "Whiteboards");
migrationBuilder.DropColumn(
name: "CreatedAt",
table: "Users");
migrationBuilder.DropColumn(
name: "DeletedAt",
table: "Users");
migrationBuilder.RenameColumn(
name: "OwnerId",
table: "Whiteboards",
newName: "WhiteboardOwnerId");
}
}
}

View File

@@ -22,12 +22,68 @@ namespace AipsCore.Infrastructure.Persistence.Db.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.Shape.Shape", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("AuthorId")
.HasColumnType("uuid");
b.Property<string>("Color")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<int?>("EndPositionX")
.HasColumnType("integer");
b.Property<int?>("EndPositionY")
.HasColumnType("integer");
b.Property<int>("PositionX")
.HasColumnType("integer");
b.Property<int>("PositionY")
.HasColumnType("integer");
b.Property<int?>("TextSize")
.HasColumnType("integer");
b.Property<string>("TextValue")
.HasColumnType("text");
b.Property<int?>("Thickness")
.HasColumnType("integer");
b.Property<int>("Type")
.HasColumnType("integer");
b.Property<Guid>("WhiteboardId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("AuthorId");
b.HasIndex("WhiteboardId");
b.ToTable("Shapes");
});
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.User.User", b => modelBuilder.Entity("AipsCore.Infrastructure.Persistence.User.User", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email") b.Property<string>("Email")
.IsRequired() .IsRequired()
.HasMaxLength(255) .HasMaxLength(255)
@@ -54,17 +110,132 @@ namespace AipsCore.Infrastructure.Persistence.Db.Migrations
.HasMaxLength(8) .HasMaxLength(8)
.HasColumnType("character varying(8)"); .HasColumnType("character varying(8)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property<int>("JoinPolicy")
.HasColumnType("integer");
b.Property<int>("MaxParticipants")
.HasColumnType("integer");
b.Property<Guid>("OwnerId")
.HasColumnType("uuid");
b.Property<int>("State")
.HasColumnType("integer");
b.Property<string>("Title") b.Property<string>("Title")
.IsRequired() .IsRequired()
.HasMaxLength(32) .HasMaxLength(32)
.HasColumnType("character varying(32)"); .HasColumnType("character varying(32)");
b.Property<Guid>("WhiteboardOwnerId") b.HasKey("Id");
b.HasIndex("OwnerId");
b.ToTable("Whiteboards");
});
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.WhiteboardMembership.WhiteboardMembership", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<bool>("CanJoin")
.HasColumnType("boolean");
b.Property<bool>("EditingEnabled")
.HasColumnType("boolean");
b.Property<bool>("IsBanned")
.HasColumnType("boolean");
b.Property<DateTime>("LastInteractedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<Guid>("WhiteboardId")
.HasColumnType("uuid"); .HasColumnType("uuid");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Whiteboards"); b.HasIndex("UserId");
b.HasIndex("WhiteboardId");
b.ToTable("WhiteboardMemberships");
});
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.Shape.Shape", b =>
{
b.HasOne("AipsCore.Infrastructure.Persistence.User.User", "Author")
.WithMany("Shapes")
.HasForeignKey("AuthorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AipsCore.Infrastructure.Persistence.Whiteboard.Whiteboard", "Whiteboard")
.WithMany("Shapes")
.HasForeignKey("WhiteboardId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
b.Navigation("Whiteboard");
});
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.Whiteboard.Whiteboard", b =>
{
b.HasOne("AipsCore.Infrastructure.Persistence.User.User", "Owner")
.WithMany("Whiteboards")
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Owner");
});
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.WhiteboardMembership.WhiteboardMembership", b =>
{
b.HasOne("AipsCore.Infrastructure.Persistence.User.User", "User")
.WithMany("Memberships")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AipsCore.Infrastructure.Persistence.Whiteboard.Whiteboard", "Whiteboard")
.WithMany("Memberships")
.HasForeignKey("WhiteboardId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
b.Navigation("Whiteboard");
});
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.User.User", b =>
{
b.Navigation("Memberships");
b.Navigation("Shapes");
b.Navigation("Whiteboards");
});
modelBuilder.Entity("AipsCore.Infrastructure.Persistence.Whiteboard.Whiteboard", b =>
{
b.Navigation("Memberships");
b.Navigation("Shapes");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }