gehgassi_backend/gehGassi.Persistence/Migrations/20220921100739_BannerStatisticsAdded.cs

55 lines
2.4 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace gehGassi.Persistence.Migrations
{
public partial class BannerStatisticsAdded : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "BannerStatistics",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
BannerId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
AppMode = table.Column<int>(type: "int", nullable: false),
EventDate = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
Year = table.Column<int>(type: "int", nullable: false),
Month = table.Column<int>(type: "int", nullable: false),
Day = table.Column<int>(type: "int", nullable: false),
Hour = table.Column<int>(type: "int", nullable: false),
StatisticType = table.Column<int>(type: "int", nullable: false),
Value = table.Column<int>(type: "int", nullable: false),
Language = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
CountryCode = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false),
StateCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BannerStatistics", x => x.Id);
table.ForeignKey(
name: "FK_BannerStatistics_Banners_BannerId",
column: x => x.BannerId,
principalTable: "Banners",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_BannerStatistics_BannerId",
table: "BannerStatistics",
column: "BannerId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BannerStatistics");
}
}
}