Загрузил миграции
All checks were successful
Create and publish a Docker image / Publish image (push) Successful in 18s
Create and publish a Docker image / Deploy image (push) Successful in 2s

This commit is contained in:
Sergey Karmanov 2023-08-26 13:38:30 +03:00
parent dbd21a699f
commit 7a6acd24ac
Signed by: serega404
GPG Key ID: B6AD49C8C835460C
9 changed files with 1373 additions and 0 deletions

View File

@ -0,0 +1,125 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Question")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("CardQuestions");
});
modelBuilder.Entity("FichaBackend.Models.City", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Cities");
});
modelBuilder.Entity("FichaBackend.Models.Film", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Cinema")
.IsRequired()
.HasColumnType("text");
b.Property<long>("CityId")
.HasColumnType("bigint");
b.Property<string>("FilmName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Genre")
.HasColumnType("text");
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<float>("Price")
.HasColumnType("real");
b.Property<string>("Time")
.HasColumnType("text");
b.Property<string>("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
}
}
}

View File

@ -0,0 +1,87 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace FichaBackend.Migrations
{
/// <inheritdoc />
public partial class Initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CardQuestions",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Question = table.Column<string>(type: "text", nullable: false),
ImageURL = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CardQuestions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Cities",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
ImageURL = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Cities", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Films",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
CityId = table.Column<long>(type: "bigint", nullable: false),
Cinema = table.Column<string>(type: "text", nullable: false),
FilmName = table.Column<string>(type: "text", nullable: false),
ImageURL = table.Column<string>(type: "text", nullable: false),
Url = table.Column<string>(type: "text", nullable: false),
Genre = table.Column<string>(type: "text", nullable: true),
Time = table.Column<string>(type: "text", nullable: true),
Price = table.Column<float>(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");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CardQuestions");
migrationBuilder.DropTable(
name: "Films");
migrationBuilder.DropTable(
name: "Cities");
}
}
}

View File

@ -0,0 +1,212 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Question")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("CardQuestions");
});
modelBuilder.Entity("FichaBackend.Models.City", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<long?>("GuideId")
.HasColumnType("bigint");
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("GuideId");
b.ToTable("Cities");
});
modelBuilder.Entity("FichaBackend.Models.Film", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Cinema")
.IsRequired()
.HasColumnType("text");
b.Property<long>("CityId")
.HasColumnType("bigint");
b.Property<string>("FilmName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Genre")
.HasColumnType("text");
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<float>("Price")
.HasColumnType("real");
b.Property<string>("Time")
.HasColumnType("text");
b.Property<string>("Url")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CityId");
b.ToTable("Films");
});
modelBuilder.Entity("FichaBackend.Models.Guide", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ContactUrl")
.HasColumnType("text");
b.Property<string>("FullName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasColumnType("text");
b.Property<float>("Rating")
.HasColumnType("real");
b.HasKey("Id");
b.ToTable("Guides");
});
modelBuilder.Entity("FichaBackend.Models.Museum", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<long>("CityId")
.HasColumnType("bigint");
b.Property<double>("Latitude")
.HasColumnType("double precision");
b.Property<double>("Longtitude")
.HasColumnType("double precision");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<float?>("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
}
}
}

View File

@ -0,0 +1,99 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace FichaBackend.Migrations
{
/// <inheritdoc />
public partial class @new : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "GuideId",
table: "Cities",
type: "bigint",
nullable: true);
migrationBuilder.CreateTable(
name: "Guides",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
FullName = table.Column<string>(type: "text", nullable: false),
PhoneNumber = table.Column<string>(type: "text", nullable: false),
ContactUrl = table.Column<string>(type: "text", nullable: true),
Rating = table.Column<float>(type: "real", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Guides", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Museums",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
CityId = table.Column<long>(type: "bigint", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Longtitude = table.Column<double>(type: "double precision", nullable: false),
Latitude = table.Column<double>(type: "double precision", nullable: false),
Price = table.Column<float>(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");
}
/// <inheritdoc />
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");
}
}
}

View File

@ -0,0 +1,215 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Question")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("CardQuestions");
});
modelBuilder.Entity("FichaBackend.Models.City", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<long?>("GuideId")
.HasColumnType("bigint");
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("GuideId");
b.ToTable("Cities");
});
modelBuilder.Entity("FichaBackend.Models.Film", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Cinema")
.IsRequired()
.HasColumnType("text");
b.Property<long>("CityId")
.HasColumnType("bigint");
b.Property<string>("FilmName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Genre")
.HasColumnType("text");
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<float>("Price")
.HasColumnType("real");
b.Property<string>("Time")
.HasColumnType("text");
b.Property<string>("Url")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CityId");
b.ToTable("Films");
});
modelBuilder.Entity("FichaBackend.Models.Guide", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ContactUrl")
.HasColumnType("text");
b.Property<string>("FullName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasColumnType("text");
b.Property<float>("Rating")
.HasColumnType("real");
b.HasKey("Id");
b.ToTable("Guides");
});
modelBuilder.Entity("FichaBackend.Models.Museum", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Address")
.HasColumnType("text");
b.Property<long>("CityId")
.HasColumnType("bigint");
b.Property<double>("Latitude")
.HasColumnType("double precision");
b.Property<double>("Longtitude")
.HasColumnType("double precision");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<float?>("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
}
}
}

View File

@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FichaBackend.Migrations
{
/// <inheritdoc />
public partial class AddAddress : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Address",
table: "Museums",
type: "text",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Address",
table: "Museums");
}
}
}

View File

@ -0,0 +1,276 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Address")
.IsRequired()
.HasColumnType("text");
b.Property<string>("City")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Attractions");
});
modelBuilder.Entity("FichaBackend.Models.CardQuestion", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Question")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("CardQuestions");
});
modelBuilder.Entity("FichaBackend.Models.City", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<long?>("GuideId")
.HasColumnType("bigint");
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("GuideId");
b.ToTable("Cities");
});
modelBuilder.Entity("FichaBackend.Models.Film", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Cinema")
.IsRequired()
.HasColumnType("text");
b.Property<long>("CityId")
.HasColumnType("bigint");
b.Property<string>("FilmName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Genre")
.HasColumnType("text");
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<float>("Price")
.HasColumnType("real");
b.Property<string>("Time")
.HasColumnType("text");
b.Property<string>("Url")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CityId");
b.ToTable("Films");
});
modelBuilder.Entity("FichaBackend.Models.Guide", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ContactUrl")
.HasColumnType("text");
b.Property<string>("FullName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasColumnType("text");
b.Property<float>("Rating")
.HasColumnType("real");
b.HasKey("Id");
b.ToTable("Guides");
});
modelBuilder.Entity("FichaBackend.Models.Hotel", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Address")
.IsRequired()
.HasColumnType("text");
b.Property<string>("City")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<float>("Price")
.HasColumnType("real");
b.HasKey("Id");
b.ToTable("Hotels");
});
modelBuilder.Entity("FichaBackend.Models.Museum", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Address")
.HasColumnType("text");
b.Property<long>("CityId")
.HasColumnType("bigint");
b.Property<double>("Latitude")
.HasColumnType("double precision");
b.Property<double>("Longtitude")
.HasColumnType("double precision");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<float?>("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
}
}
}

View File

@ -0,0 +1,58 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace FichaBackend.Migrations
{
/// <inheritdoc />
public partial class AddedAttractionAndHotels : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Attractions",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
City = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Address = table.Column<string>(type: "text", nullable: false),
ImageURL = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Attractions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Hotels",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
City = table.Column<string>(type: "text", nullable: false),
Price = table.Column<float>(type: "real", nullable: false),
Address = table.Column<string>(type: "text", nullable: false),
ImageURL = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Hotels", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Attractions");
migrationBuilder.DropTable(
name: "Hotels");
}
}
}

View File

@ -0,0 +1,273 @@
// <auto-generated />
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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Address")
.IsRequired()
.HasColumnType("text");
b.Property<string>("City")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Attractions");
});
modelBuilder.Entity("FichaBackend.Models.CardQuestion", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Question")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("CardQuestions");
});
modelBuilder.Entity("FichaBackend.Models.City", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<long?>("GuideId")
.HasColumnType("bigint");
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("GuideId");
b.ToTable("Cities");
});
modelBuilder.Entity("FichaBackend.Models.Film", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Cinema")
.IsRequired()
.HasColumnType("text");
b.Property<long>("CityId")
.HasColumnType("bigint");
b.Property<string>("FilmName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Genre")
.HasColumnType("text");
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<float>("Price")
.HasColumnType("real");
b.Property<string>("Time")
.HasColumnType("text");
b.Property<string>("Url")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CityId");
b.ToTable("Films");
});
modelBuilder.Entity("FichaBackend.Models.Guide", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ContactUrl")
.HasColumnType("text");
b.Property<string>("FullName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasColumnType("text");
b.Property<float>("Rating")
.HasColumnType("real");
b.HasKey("Id");
b.ToTable("Guides");
});
modelBuilder.Entity("FichaBackend.Models.Hotel", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Address")
.IsRequired()
.HasColumnType("text");
b.Property<string>("City")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ImageURL")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<float>("Price")
.HasColumnType("real");
b.HasKey("Id");
b.ToTable("Hotels");
});
modelBuilder.Entity("FichaBackend.Models.Museum", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Address")
.HasColumnType("text");
b.Property<long>("CityId")
.HasColumnType("bigint");
b.Property<double>("Latitude")
.HasColumnType("double precision");
b.Property<double>("Longtitude")
.HasColumnType("double precision");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<float?>("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
}
}
}