diff --git a/AbazovApp/AccountsApp/AccountsApp.csproj b/AbazovApp/AccountsApp/AccountsApp.csproj index 45a05e7..cb91785 100644 --- a/AbazovApp/AccountsApp/AccountsApp.csproj +++ b/AbazovApp/AccountsApp/AccountsApp.csproj @@ -11,7 +11,15 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + \ No newline at end of file diff --git a/AbazovApp/AccountsDataBaseImplement/Migrations/20231116164358_InitialCreate.Designer.cs b/AbazovApp/AccountsDataBaseImplement/Migrations/20231116164358_InitialCreate.Designer.cs new file mode 100644 index 0000000..712457c --- /dev/null +++ b/AbazovApp/AccountsDataBaseImplement/Migrations/20231116164358_InitialCreate.Designer.cs @@ -0,0 +1,118 @@ +// +using AccountsDataBaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace AccountsDataBaseImplement.Migrations +{ + [DbContext(typeof(AccountsDatabase))] + [Migration("20231116164358_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("AccountsDataBaseImplement.Models.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("Login") + .IsRequired() + .HasColumnType("text"); + + b.Property("Password") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Accounts"); + }); + + modelBuilder.Entity("AccountsDataBaseImplement.Models.AccountInterest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("integer"); + + b.Property("InterestId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.HasIndex("InterestId"); + + b.ToTable("AccountInterests"); + }); + + modelBuilder.Entity("AccountsDataBaseImplement.Models.Interest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Interests"); + }); + + modelBuilder.Entity("AccountsDataBaseImplement.Models.AccountInterest", b => + { + b.HasOne("AccountsDataBaseImplement.Models.Account", "Account") + .WithMany("Interests") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AccountsDataBaseImplement.Models.Interest", "Interest") + .WithMany() + .HasForeignKey("InterestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + + b.Navigation("Interest"); + }); + + modelBuilder.Entity("AccountsDataBaseImplement.Models.Account", b => + { + b.Navigation("Interests"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/AbazovApp/AccountsDataBaseImplement/Migrations/20231116164358_InitialCreate.cs b/AbazovApp/AccountsDataBaseImplement/Migrations/20231116164358_InitialCreate.cs new file mode 100644 index 0000000..9aa66ba --- /dev/null +++ b/AbazovApp/AccountsDataBaseImplement/Migrations/20231116164358_InitialCreate.cs @@ -0,0 +1,92 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace AccountsDataBaseImplement.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Accounts", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Login = table.Column(type: "text", nullable: false), + Password = table.Column(type: "text", nullable: false), + Email = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Accounts", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Interests", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Interests", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AccountInterests", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AccountId = table.Column(type: "integer", nullable: false), + InterestId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AccountInterests", x => x.Id); + table.ForeignKey( + name: "FK_AccountInterests_Accounts_AccountId", + column: x => x.AccountId, + principalTable: "Accounts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AccountInterests_Interests_InterestId", + column: x => x.InterestId, + principalTable: "Interests", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AccountInterests_AccountId", + table: "AccountInterests", + column: "AccountId"); + + migrationBuilder.CreateIndex( + name: "IX_AccountInterests_InterestId", + table: "AccountInterests", + column: "InterestId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AccountInterests"); + + migrationBuilder.DropTable( + name: "Accounts"); + + migrationBuilder.DropTable( + name: "Interests"); + } + } +} diff --git a/AbazovApp/AccountsDataBaseImplement/Migrations/AccountsDatabaseModelSnapshot.cs b/AbazovApp/AccountsDataBaseImplement/Migrations/AccountsDatabaseModelSnapshot.cs new file mode 100644 index 0000000..5c23ad4 --- /dev/null +++ b/AbazovApp/AccountsDataBaseImplement/Migrations/AccountsDatabaseModelSnapshot.cs @@ -0,0 +1,115 @@ +// +using AccountsDataBaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace AccountsDataBaseImplement.Migrations +{ + [DbContext(typeof(AccountsDatabase))] + partial class AccountsDatabaseModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("AccountsDataBaseImplement.Models.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("Login") + .IsRequired() + .HasColumnType("text"); + + b.Property("Password") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Accounts"); + }); + + modelBuilder.Entity("AccountsDataBaseImplement.Models.AccountInterest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("integer"); + + b.Property("InterestId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.HasIndex("InterestId"); + + b.ToTable("AccountInterests"); + }); + + modelBuilder.Entity("AccountsDataBaseImplement.Models.Interest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Interests"); + }); + + modelBuilder.Entity("AccountsDataBaseImplement.Models.AccountInterest", b => + { + b.HasOne("AccountsDataBaseImplement.Models.Account", "Account") + .WithMany("Interests") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AccountsDataBaseImplement.Models.Interest", "Interest") + .WithMany() + .HasForeignKey("InterestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + + b.Navigation("Interest"); + }); + + modelBuilder.Entity("AccountsDataBaseImplement.Models.Account", b => + { + b.Navigation("Interests"); + }); +#pragma warning restore 612, 618 + } + } +}