SUBD_SportCompetitions/SportCompetitionsDatabaseImplement/Migrations/20240423180214_last.cs

114 lines
4.9 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace SportCompetitionsDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class last : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Competitions",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
CompetitionName = table.Column<string>(type: "text", nullable: false),
CompetitionDateHolding = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CompetitionCity = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Competitions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Members",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
MemberFCs = table.Column<string>(type: "text", nullable: false),
MemberBirthDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
MemberGender = table.Column<string>(type: "text", nullable: false),
TeamId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Members", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Records",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RecordName = table.Column<string>(type: "text", nullable: false),
RecordDecriptiption = table.Column<string>(type: "text", nullable: false),
MemberId = table.Column<int>(type: "integer", nullable: false),
RecordDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
RecordValue = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Records", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Results",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ResultName = table.Column<string>(type: "text", nullable: false),
CompetitionId = table.Column<int>(type: "integer", nullable: false),
TeamId = table.Column<int>(type: "integer", nullable: false),
ResultPosition = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Results", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Teams",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
TeamName = table.Column<string>(type: "text", nullable: false),
TeamCountry = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Teams", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Competitions");
migrationBuilder.DropTable(
name: "Members");
migrationBuilder.DropTable(
name: "Records");
migrationBuilder.DropTable(
name: "Results");
migrationBuilder.DropTable(
name: "Teams");
}
}
}