diff --git a/FichaBackend/Migrations/20230825061202_Initial.Designer.cs b/FichaBackend/Migrations/20230825061202_Initial.Designer.cs new file mode 100644 index 0000000..1fb78a9 --- /dev/null +++ b/FichaBackend/Migrations/20230825061202_Initial.Designer.cs @@ -0,0 +1,125 @@ +// +using FichaBackend; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace FichaBackend.Migrations +{ + [DbContext(typeof(DatabaseContext))] + [Migration("20230825061202_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.9") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("FichaBackend.Models.CardQuestion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Question") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("CardQuestions"); + }); + + modelBuilder.Entity("FichaBackend.Models.City", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Cities"); + }); + + modelBuilder.Entity("FichaBackend.Models.Film", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Cinema") + .IsRequired() + .HasColumnType("text"); + + b.Property("CityId") + .HasColumnType("bigint"); + + b.Property("FilmName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Genre") + .HasColumnType("text"); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("real"); + + b.Property("Time") + .HasColumnType("text"); + + b.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CityId"); + + b.ToTable("Films"); + }); + + modelBuilder.Entity("FichaBackend.Models.Film", b => + { + b.HasOne("FichaBackend.Models.City", "City") + .WithMany() + .HasForeignKey("CityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("City"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FichaBackend/Migrations/20230825061202_Initial.cs b/FichaBackend/Migrations/20230825061202_Initial.cs new file mode 100644 index 0000000..6f4446f --- /dev/null +++ b/FichaBackend/Migrations/20230825061202_Initial.cs @@ -0,0 +1,87 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace FichaBackend.Migrations +{ + /// + public partial class Initial : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "CardQuestions", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Question = table.Column(type: "text", nullable: false), + ImageURL = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CardQuestions", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Cities", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false), + ImageURL = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Cities", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Films", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + CityId = table.Column(type: "bigint", nullable: false), + Cinema = table.Column(type: "text", nullable: false), + FilmName = table.Column(type: "text", nullable: false), + ImageURL = table.Column(type: "text", nullable: false), + Url = table.Column(type: "text", nullable: false), + Genre = table.Column(type: "text", nullable: true), + Time = table.Column(type: "text", nullable: true), + Price = table.Column(type: "real", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Films", x => x.Id); + table.ForeignKey( + name: "FK_Films_Cities_CityId", + column: x => x.CityId, + principalTable: "Cities", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Films_CityId", + table: "Films", + column: "CityId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CardQuestions"); + + migrationBuilder.DropTable( + name: "Films"); + + migrationBuilder.DropTable( + name: "Cities"); + } + } +} diff --git a/FichaBackend/Migrations/20230825132916_new.Designer.cs b/FichaBackend/Migrations/20230825132916_new.Designer.cs new file mode 100644 index 0000000..f3b12df --- /dev/null +++ b/FichaBackend/Migrations/20230825132916_new.Designer.cs @@ -0,0 +1,212 @@ +// +using System; +using FichaBackend; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace FichaBackend.Migrations +{ + [DbContext(typeof(DatabaseContext))] + [Migration("20230825132916_new")] + partial class @new + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.9") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("FichaBackend.Models.CardQuestion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Question") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("CardQuestions"); + }); + + modelBuilder.Entity("FichaBackend.Models.City", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("GuideId") + .HasColumnType("bigint"); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuideId"); + + b.ToTable("Cities"); + }); + + modelBuilder.Entity("FichaBackend.Models.Film", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Cinema") + .IsRequired() + .HasColumnType("text"); + + b.Property("CityId") + .HasColumnType("bigint"); + + b.Property("FilmName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Genre") + .HasColumnType("text"); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("real"); + + b.Property("Time") + .HasColumnType("text"); + + b.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CityId"); + + b.ToTable("Films"); + }); + + modelBuilder.Entity("FichaBackend.Models.Guide", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ContactUrl") + .HasColumnType("text"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("Rating") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.ToTable("Guides"); + }); + + modelBuilder.Entity("FichaBackend.Models.Museum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CityId") + .HasColumnType("bigint"); + + b.Property("Latitude") + .HasColumnType("double precision"); + + b.Property("Longtitude") + .HasColumnType("double precision"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.HasIndex("CityId"); + + b.ToTable("Museums"); + }); + + modelBuilder.Entity("FichaBackend.Models.City", b => + { + b.HasOne("FichaBackend.Models.Guide", null) + .WithMany("City") + .HasForeignKey("GuideId"); + }); + + modelBuilder.Entity("FichaBackend.Models.Film", b => + { + b.HasOne("FichaBackend.Models.City", "City") + .WithMany() + .HasForeignKey("CityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("City"); + }); + + modelBuilder.Entity("FichaBackend.Models.Museum", b => + { + b.HasOne("FichaBackend.Models.City", "City") + .WithMany() + .HasForeignKey("CityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("City"); + }); + + modelBuilder.Entity("FichaBackend.Models.Guide", b => + { + b.Navigation("City"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FichaBackend/Migrations/20230825132916_new.cs b/FichaBackend/Migrations/20230825132916_new.cs new file mode 100644 index 0000000..65ae007 --- /dev/null +++ b/FichaBackend/Migrations/20230825132916_new.cs @@ -0,0 +1,99 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace FichaBackend.Migrations +{ + /// + public partial class @new : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "GuideId", + table: "Cities", + type: "bigint", + nullable: true); + + migrationBuilder.CreateTable( + name: "Guides", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + FullName = table.Column(type: "text", nullable: false), + PhoneNumber = table.Column(type: "text", nullable: false), + ContactUrl = table.Column(type: "text", nullable: true), + Rating = table.Column(type: "real", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Guides", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Museums", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + CityId = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: false), + Longtitude = table.Column(type: "double precision", nullable: false), + Latitude = table.Column(type: "double precision", nullable: false), + Price = table.Column(type: "real", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Museums", x => x.Id); + table.ForeignKey( + name: "FK_Museums_Cities_CityId", + column: x => x.CityId, + principalTable: "Cities", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Cities_GuideId", + table: "Cities", + column: "GuideId"); + + migrationBuilder.CreateIndex( + name: "IX_Museums_CityId", + table: "Museums", + column: "CityId"); + + migrationBuilder.AddForeignKey( + name: "FK_Cities_Guides_GuideId", + table: "Cities", + column: "GuideId", + principalTable: "Guides", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Cities_Guides_GuideId", + table: "Cities"); + + migrationBuilder.DropTable( + name: "Guides"); + + migrationBuilder.DropTable( + name: "Museums"); + + migrationBuilder.DropIndex( + name: "IX_Cities_GuideId", + table: "Cities"); + + migrationBuilder.DropColumn( + name: "GuideId", + table: "Cities"); + } + } +} diff --git a/FichaBackend/Migrations/20230825144307_AddAddress.Designer.cs b/FichaBackend/Migrations/20230825144307_AddAddress.Designer.cs new file mode 100644 index 0000000..cec167b --- /dev/null +++ b/FichaBackend/Migrations/20230825144307_AddAddress.Designer.cs @@ -0,0 +1,215 @@ +// +using System; +using FichaBackend; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace FichaBackend.Migrations +{ + [DbContext(typeof(DatabaseContext))] + [Migration("20230825144307_AddAddress")] + partial class AddAddress + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.9") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("FichaBackend.Models.CardQuestion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Question") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("CardQuestions"); + }); + + modelBuilder.Entity("FichaBackend.Models.City", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("GuideId") + .HasColumnType("bigint"); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuideId"); + + b.ToTable("Cities"); + }); + + modelBuilder.Entity("FichaBackend.Models.Film", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Cinema") + .IsRequired() + .HasColumnType("text"); + + b.Property("CityId") + .HasColumnType("bigint"); + + b.Property("FilmName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Genre") + .HasColumnType("text"); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("real"); + + b.Property("Time") + .HasColumnType("text"); + + b.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CityId"); + + b.ToTable("Films"); + }); + + modelBuilder.Entity("FichaBackend.Models.Guide", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ContactUrl") + .HasColumnType("text"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("Rating") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.ToTable("Guides"); + }); + + modelBuilder.Entity("FichaBackend.Models.Museum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("CityId") + .HasColumnType("bigint"); + + b.Property("Latitude") + .HasColumnType("double precision"); + + b.Property("Longtitude") + .HasColumnType("double precision"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.HasIndex("CityId"); + + b.ToTable("Museums"); + }); + + modelBuilder.Entity("FichaBackend.Models.City", b => + { + b.HasOne("FichaBackend.Models.Guide", null) + .WithMany("City") + .HasForeignKey("GuideId"); + }); + + modelBuilder.Entity("FichaBackend.Models.Film", b => + { + b.HasOne("FichaBackend.Models.City", "City") + .WithMany() + .HasForeignKey("CityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("City"); + }); + + modelBuilder.Entity("FichaBackend.Models.Museum", b => + { + b.HasOne("FichaBackend.Models.City", "City") + .WithMany() + .HasForeignKey("CityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("City"); + }); + + modelBuilder.Entity("FichaBackend.Models.Guide", b => + { + b.Navigation("City"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FichaBackend/Migrations/20230825144307_AddAddress.cs b/FichaBackend/Migrations/20230825144307_AddAddress.cs new file mode 100644 index 0000000..ec62461 --- /dev/null +++ b/FichaBackend/Migrations/20230825144307_AddAddress.cs @@ -0,0 +1,28 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FichaBackend.Migrations +{ + /// + public partial class AddAddress : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Address", + table: "Museums", + type: "text", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Address", + table: "Museums"); + } + } +} diff --git a/FichaBackend/Migrations/20230826102623_AddedAttractionAndHotels.Designer.cs b/FichaBackend/Migrations/20230826102623_AddedAttractionAndHotels.Designer.cs new file mode 100644 index 0000000..ec8df3a --- /dev/null +++ b/FichaBackend/Migrations/20230826102623_AddedAttractionAndHotels.Designer.cs @@ -0,0 +1,276 @@ +// +using System; +using FichaBackend; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace FichaBackend.Migrations +{ + [DbContext(typeof(DatabaseContext))] + [Migration("20230826102623_AddedAttractionAndHotels")] + partial class AddedAttractionAndHotels + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.9") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("FichaBackend.Models.Attraction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("City") + .IsRequired() + .HasColumnType("text"); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Attractions"); + }); + + modelBuilder.Entity("FichaBackend.Models.CardQuestion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Question") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("CardQuestions"); + }); + + modelBuilder.Entity("FichaBackend.Models.City", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("GuideId") + .HasColumnType("bigint"); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuideId"); + + b.ToTable("Cities"); + }); + + modelBuilder.Entity("FichaBackend.Models.Film", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Cinema") + .IsRequired() + .HasColumnType("text"); + + b.Property("CityId") + .HasColumnType("bigint"); + + b.Property("FilmName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Genre") + .HasColumnType("text"); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("real"); + + b.Property("Time") + .HasColumnType("text"); + + b.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CityId"); + + b.ToTable("Films"); + }); + + modelBuilder.Entity("FichaBackend.Models.Guide", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ContactUrl") + .HasColumnType("text"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("Rating") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.ToTable("Guides"); + }); + + modelBuilder.Entity("FichaBackend.Models.Hotel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("City") + .IsRequired() + .HasColumnType("text"); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.ToTable("Hotels"); + }); + + modelBuilder.Entity("FichaBackend.Models.Museum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("CityId") + .HasColumnType("bigint"); + + b.Property("Latitude") + .HasColumnType("double precision"); + + b.Property("Longtitude") + .HasColumnType("double precision"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.HasIndex("CityId"); + + b.ToTable("Museums"); + }); + + modelBuilder.Entity("FichaBackend.Models.City", b => + { + b.HasOne("FichaBackend.Models.Guide", null) + .WithMany("City") + .HasForeignKey("GuideId"); + }); + + modelBuilder.Entity("FichaBackend.Models.Film", b => + { + b.HasOne("FichaBackend.Models.City", "City") + .WithMany() + .HasForeignKey("CityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("City"); + }); + + modelBuilder.Entity("FichaBackend.Models.Museum", b => + { + b.HasOne("FichaBackend.Models.City", "City") + .WithMany() + .HasForeignKey("CityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("City"); + }); + + modelBuilder.Entity("FichaBackend.Models.Guide", b => + { + b.Navigation("City"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FichaBackend/Migrations/20230826102623_AddedAttractionAndHotels.cs b/FichaBackend/Migrations/20230826102623_AddedAttractionAndHotels.cs new file mode 100644 index 0000000..82c7e7a --- /dev/null +++ b/FichaBackend/Migrations/20230826102623_AddedAttractionAndHotels.cs @@ -0,0 +1,58 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace FichaBackend.Migrations +{ + /// + public partial class AddedAttractionAndHotels : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Attractions", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + City = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: false), + Address = table.Column(type: "text", nullable: false), + ImageURL = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Attractions", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Hotels", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false), + City = table.Column(type: "text", nullable: false), + Price = table.Column(type: "real", nullable: false), + Address = table.Column(type: "text", nullable: false), + ImageURL = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Hotels", x => x.Id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Attractions"); + + migrationBuilder.DropTable( + name: "Hotels"); + } + } +} diff --git a/FichaBackend/Migrations/DatabaseContextModelSnapshot.cs b/FichaBackend/Migrations/DatabaseContextModelSnapshot.cs new file mode 100644 index 0000000..a645c1f --- /dev/null +++ b/FichaBackend/Migrations/DatabaseContextModelSnapshot.cs @@ -0,0 +1,273 @@ +// +using System; +using FichaBackend; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace FichaBackend.Migrations +{ + [DbContext(typeof(DatabaseContext))] + partial class DatabaseContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.9") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("FichaBackend.Models.Attraction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("City") + .IsRequired() + .HasColumnType("text"); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Attractions"); + }); + + modelBuilder.Entity("FichaBackend.Models.CardQuestion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Question") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("CardQuestions"); + }); + + modelBuilder.Entity("FichaBackend.Models.City", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("GuideId") + .HasColumnType("bigint"); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuideId"); + + b.ToTable("Cities"); + }); + + modelBuilder.Entity("FichaBackend.Models.Film", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Cinema") + .IsRequired() + .HasColumnType("text"); + + b.Property("CityId") + .HasColumnType("bigint"); + + b.Property("FilmName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Genre") + .HasColumnType("text"); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("real"); + + b.Property("Time") + .HasColumnType("text"); + + b.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CityId"); + + b.ToTable("Films"); + }); + + modelBuilder.Entity("FichaBackend.Models.Guide", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ContactUrl") + .HasColumnType("text"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("Rating") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.ToTable("Guides"); + }); + + modelBuilder.Entity("FichaBackend.Models.Hotel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("City") + .IsRequired() + .HasColumnType("text"); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.ToTable("Hotels"); + }); + + modelBuilder.Entity("FichaBackend.Models.Museum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("CityId") + .HasColumnType("bigint"); + + b.Property("Latitude") + .HasColumnType("double precision"); + + b.Property("Longtitude") + .HasColumnType("double precision"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.HasIndex("CityId"); + + b.ToTable("Museums"); + }); + + modelBuilder.Entity("FichaBackend.Models.City", b => + { + b.HasOne("FichaBackend.Models.Guide", null) + .WithMany("City") + .HasForeignKey("GuideId"); + }); + + modelBuilder.Entity("FichaBackend.Models.Film", b => + { + b.HasOne("FichaBackend.Models.City", "City") + .WithMany() + .HasForeignKey("CityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("City"); + }); + + modelBuilder.Entity("FichaBackend.Models.Museum", b => + { + b.HasOne("FichaBackend.Models.City", "City") + .WithMany() + .HasForeignKey("CityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("City"); + }); + + modelBuilder.Entity("FichaBackend.Models.Guide", b => + { + b.Navigation("City"); + }); +#pragma warning restore 612, 618 + } + } +}