Compare commits

..

1 Commits

Author SHA1 Message Date
ebe831ce78 postgres 2024-05-30 03:40:26 +04:00
9 changed files with 184 additions and 178 deletions

View File

@ -2,9 +2,9 @@
using System; using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using TravelAgencyDatabaseImplement; using TravelAgencyDatabaseImplement;
#nullable disable #nullable disable
@ -12,7 +12,7 @@ using TravelAgencyDatabaseImplement;
namespace TravelAgencyDatabaseImplement.Migrations namespace TravelAgencyDatabaseImplement.Migrations
{ {
[DbContext(typeof(TravelAgencyDatabase))] [DbContext(typeof(TravelAgencyDatabase))]
[Migration("20240529060724_InitialCreate")] [Migration("20240529231522_InitialCreate")]
partial class InitialCreate partial class InitialCreate
{ {
/// <inheritdoc /> /// <inheritdoc />
@ -21,34 +21,34 @@ namespace TravelAgencyDatabaseImplement.Migrations
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "7.0.18") .HasAnnotation("ProductVersion", "7.0.18")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 63);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.Excursion", b => modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.Excursion", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ExcursionDescription") b.Property<string>("ExcursionDescription")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("ExcursionName") b.Property<string>("ExcursionName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<int>("PlaceId") b.Property<int>("PlaceId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<double>("Price") b.Property<double>("Price")
.HasColumnType("float"); .HasColumnType("double precision");
b.Property<int>("UserId") b.Property<int>("UserId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -63,22 +63,22 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ExcursionGroupName") b.Property<string>("ExcursionGroupName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<int>("GuideId") b.Property<int>("GuideId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("ParticipantsAmount") b.Property<int>("ParticipantsAmount")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("UserId") b.Property<int>("UserId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -93,15 +93,15 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ExcursionGroupId") b.Property<int>("ExcursionGroupId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("PlaceId") b.Property<int>("PlaceId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -116,15 +116,15 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ExcursionGroupId") b.Property<int>("ExcursionGroupId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("TourId") b.Property<int>("TourId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -139,15 +139,15 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ExcursionId") b.Property<int>("ExcursionId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("TourId") b.Property<int>("TourId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -162,21 +162,21 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Email") b.Property<string>("Email")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("GuideFIO") b.Property<string>("GuideFIO")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("PhoneNumber") b.Property<string>("PhoneNumber")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@ -187,17 +187,17 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("PlaceAddress") b.Property<string>("PlaceAddress")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("PlaceName") b.Property<string>("PlaceName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@ -208,26 +208,26 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<double>("Price") b.Property<double>("Price")
.HasColumnType("float"); .HasColumnType("double precision");
b.Property<DateTime>("TourDate") b.Property<DateTime>("TourDate")
.HasColumnType("datetime2"); .HasColumnType("timestamp without time zone");
b.Property<string>("TourDescription") b.Property<string>("TourDescription")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("TourName") b.Property<string>("TourName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<int>("UserId") b.Property<int>("UserId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -240,19 +240,19 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("GuideId") b.Property<int>("GuideId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<DateTime>("TripDate") b.Property<DateTime>("TripDate")
.HasColumnType("datetime2"); .HasColumnType("timestamp without time zone");
b.Property<string>("TripName") b.Property<string>("TripName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@ -265,15 +265,15 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("PlaceId") b.Property<int>("PlaceId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("TripId") b.Property<int>("TripId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -288,25 +288,25 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Email") b.Property<string>("Email")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("Password") b.Property<string>("Password")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("PhoneNumber") b.Property<string>("PhoneNumber")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("UserFIO") b.Property<string>("UserFIO")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");

View File

@ -1,5 +1,6 @@
using System; using System;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable #nullable disable
@ -15,11 +16,11 @@ namespace TravelAgencyDatabaseImplement.Migrations
name: "Guides", name: "Guides",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
GuideFIO = table.Column<string>(type: "nvarchar(max)", nullable: false), GuideFIO = table.Column<string>(type: "text", nullable: false),
Email = table.Column<string>(type: "nvarchar(max)", nullable: false), Email = table.Column<string>(type: "text", nullable: false),
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: false) PhoneNumber = table.Column<string>(type: "text", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -30,10 +31,10 @@ namespace TravelAgencyDatabaseImplement.Migrations
name: "Places", name: "Places",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
PlaceName = table.Column<string>(type: "nvarchar(max)", nullable: false), PlaceName = table.Column<string>(type: "text", nullable: false),
PlaceAddress = table.Column<string>(type: "nvarchar(max)", nullable: false) PlaceAddress = table.Column<string>(type: "text", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -44,12 +45,12 @@ namespace TravelAgencyDatabaseImplement.Migrations
name: "Users", name: "Users",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
UserFIO = table.Column<string>(type: "nvarchar(max)", nullable: false), UserFIO = table.Column<string>(type: "text", nullable: false),
Email = table.Column<string>(type: "nvarchar(max)", nullable: false), Email = table.Column<string>(type: "text", nullable: false),
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: false), PhoneNumber = table.Column<string>(type: "text", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false) Password = table.Column<string>(type: "text", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -60,11 +61,11 @@ namespace TravelAgencyDatabaseImplement.Migrations
name: "Trips", name: "Trips",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
TripName = table.Column<string>(type: "nvarchar(max)", nullable: false), TripName = table.Column<string>(type: "text", nullable: false),
TripDate = table.Column<DateTime>(type: "datetime2", nullable: false), TripDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
GuideId = table.Column<int>(type: "int", nullable: false) GuideId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -81,12 +82,12 @@ namespace TravelAgencyDatabaseImplement.Migrations
name: "ExcursionGroups", name: "ExcursionGroups",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ExcursionGroupName = table.Column<string>(type: "nvarchar(max)", nullable: false), ExcursionGroupName = table.Column<string>(type: "text", nullable: false),
ParticipantsAmount = table.Column<int>(type: "int", nullable: false), ParticipantsAmount = table.Column<int>(type: "integer", nullable: false),
UserId = table.Column<int>(type: "int", nullable: false), UserId = table.Column<int>(type: "integer", nullable: false),
GuideId = table.Column<int>(type: "int", nullable: false) GuideId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -109,13 +110,13 @@ namespace TravelAgencyDatabaseImplement.Migrations
name: "Excursions", name: "Excursions",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ExcursionName = table.Column<string>(type: "nvarchar(max)", nullable: false), ExcursionName = table.Column<string>(type: "text", nullable: false),
ExcursionDescription = table.Column<string>(type: "nvarchar(max)", nullable: false), ExcursionDescription = table.Column<string>(type: "text", nullable: false),
Price = table.Column<double>(type: "float", nullable: false), Price = table.Column<double>(type: "double precision", nullable: false),
UserId = table.Column<int>(type: "int", nullable: false), UserId = table.Column<int>(type: "integer", nullable: false),
PlaceId = table.Column<int>(type: "int", nullable: false) PlaceId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -138,13 +139,13 @@ namespace TravelAgencyDatabaseImplement.Migrations
name: "Tours", name: "Tours",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
TourName = table.Column<string>(type: "nvarchar(max)", nullable: false), TourName = table.Column<string>(type: "text", nullable: false),
TourDescription = table.Column<string>(type: "nvarchar(max)", nullable: false), TourDescription = table.Column<string>(type: "text", nullable: false),
Price = table.Column<double>(type: "float", nullable: false), Price = table.Column<double>(type: "double precision", nullable: false),
TourDate = table.Column<DateTime>(type: "datetime2", nullable: false), TourDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
UserId = table.Column<int>(type: "int", nullable: false) UserId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -161,10 +162,10 @@ namespace TravelAgencyDatabaseImplement.Migrations
name: "TripPlaces", name: "TripPlaces",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
TripId = table.Column<int>(type: "int", nullable: false), TripId = table.Column<int>(type: "integer", nullable: false),
PlaceId = table.Column<int>(type: "int", nullable: false) PlaceId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -187,10 +188,10 @@ namespace TravelAgencyDatabaseImplement.Migrations
name: "ExcursionGroupPlaces", name: "ExcursionGroupPlaces",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ExcursionGroupId = table.Column<int>(type: "int", nullable: false), ExcursionGroupId = table.Column<int>(type: "integer", nullable: false),
PlaceId = table.Column<int>(type: "int", nullable: false) PlaceId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -213,10 +214,10 @@ namespace TravelAgencyDatabaseImplement.Migrations
name: "ExcursionGroupTours", name: "ExcursionGroupTours",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ExcursionGroupId = table.Column<int>(type: "int", nullable: false), ExcursionGroupId = table.Column<int>(type: "integer", nullable: false),
TourId = table.Column<int>(type: "int", nullable: false) TourId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -239,10 +240,10 @@ namespace TravelAgencyDatabaseImplement.Migrations
name: "ExcursionTours", name: "ExcursionTours",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ExcursionId = table.Column<int>(type: "int", nullable: false), ExcursionId = table.Column<int>(type: "integer", nullable: false),
TourId = table.Column<int>(type: "int", nullable: false) TourId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {

View File

@ -2,8 +2,8 @@
using System; using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using TravelAgencyDatabaseImplement; using TravelAgencyDatabaseImplement;
#nullable disable #nullable disable
@ -18,34 +18,34 @@ namespace TravelAgencyDatabaseImplement.Migrations
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "7.0.18") .HasAnnotation("ProductVersion", "7.0.18")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 63);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.Excursion", b => modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.Excursion", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ExcursionDescription") b.Property<string>("ExcursionDescription")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("ExcursionName") b.Property<string>("ExcursionName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<int>("PlaceId") b.Property<int>("PlaceId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<double>("Price") b.Property<double>("Price")
.HasColumnType("float"); .HasColumnType("double precision");
b.Property<int>("UserId") b.Property<int>("UserId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -60,22 +60,22 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ExcursionGroupName") b.Property<string>("ExcursionGroupName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<int>("GuideId") b.Property<int>("GuideId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("ParticipantsAmount") b.Property<int>("ParticipantsAmount")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("UserId") b.Property<int>("UserId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -90,15 +90,15 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ExcursionGroupId") b.Property<int>("ExcursionGroupId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("PlaceId") b.Property<int>("PlaceId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -113,15 +113,15 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ExcursionGroupId") b.Property<int>("ExcursionGroupId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("TourId") b.Property<int>("TourId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -136,15 +136,15 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ExcursionId") b.Property<int>("ExcursionId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("TourId") b.Property<int>("TourId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -159,21 +159,21 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Email") b.Property<string>("Email")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("GuideFIO") b.Property<string>("GuideFIO")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("PhoneNumber") b.Property<string>("PhoneNumber")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@ -184,17 +184,17 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("PlaceAddress") b.Property<string>("PlaceAddress")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("PlaceName") b.Property<string>("PlaceName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@ -205,26 +205,26 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<double>("Price") b.Property<double>("Price")
.HasColumnType("float"); .HasColumnType("double precision");
b.Property<DateTime>("TourDate") b.Property<DateTime>("TourDate")
.HasColumnType("datetime2"); .HasColumnType("timestamp without time zone");
b.Property<string>("TourDescription") b.Property<string>("TourDescription")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("TourName") b.Property<string>("TourName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<int>("UserId") b.Property<int>("UserId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -237,19 +237,19 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("GuideId") b.Property<int>("GuideId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<DateTime>("TripDate") b.Property<DateTime>("TripDate")
.HasColumnType("datetime2"); .HasColumnType("timestamp without time zone");
b.Property<string>("TripName") b.Property<string>("TripName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@ -262,15 +262,15 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("PlaceId") b.Property<int>("PlaceId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("TripId") b.Property<int>("TripId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -285,25 +285,25 @@ namespace TravelAgencyDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Email") b.Property<string>("Email")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("Password") b.Property<string>("Password")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("PhoneNumber") b.Property<string>("PhoneNumber")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<string>("UserFIO") b.Property<string>("UserFIO")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");

View File

@ -7,9 +7,10 @@ namespace TravelAgencyDatabaseImplement
{ {
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ {
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
if (optionsBuilder.IsConfigured == false) if (optionsBuilder.IsConfigured == false)
{ {
optionsBuilder.UseSqlServer(@"Data Source=.\SQLEXPRESS;Initial Catalog=TravelAgencyDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); optionsBuilder.UseNpgsql("Host=localhost;Database=CarRepairShopDBHard;Username=postgres;Password=postgres");
} }
base.OnConfiguring(optionsBuilder); base.OnConfiguring(optionsBuilder);
} }

View File

@ -13,6 +13,7 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.18" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -7,6 +7,8 @@ using TravelAgencyDatabaseImplement.Implements;
using TravelAgencyWebApp; using TravelAgencyWebApp;
using TravelAgencyBusinessLogic.MailWorker; using TravelAgencyBusinessLogic.MailWorker;
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
// Add services to the container. // Add services to the container.
builder.Services.AddControllersWithViews(); builder.Services.AddControllersWithViews();

View File

@ -68,7 +68,7 @@ namespace TravelAgencyWebApp
int houseNumber = random.Next(1, 100); int houseNumber = random.Next(1, 100);
_placeLogic.Create(new PlaceBindingModel _placeLogic.Create(new PlaceBindingModel
{ {
PlaceName = $"Место {i}", PlaceName = $"Место {i+1}",
PlaceAddress = $"{city}, {street}, {houseNumber}" PlaceAddress = $"{city}, {street}, {houseNumber}"
}); });
} }

View File

@ -3,5 +3,6 @@
} }
<div class="text-center"> <div class="text-center">
<h1 class="display-4">Турфирма «Иван Сусанин»</h1> <h1 class="display-4 m-5">Турфирма «Иван Сусанин»</h1>
<img src="~/images/Ivan_Susanin.jpg" width="600" height="600">
</div> </div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB