88 lines
3.5 KiB
C#
88 lines
3.5 KiB
C#
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");
|
|
}
|
|
}
|
|
}
|