SurveyVista/Web/Migrations/20240228172237_Initial.cs
2024-03-03 13:57:57 +01:00

165 lines
7.2 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Web.Migrations
{
/// <inheritdoc />
public partial class Initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Addresss",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Street = table.Column<string>(type: "nvarchar(max)", nullable: false),
City = table.Column<string>(type: "nvarchar(max)", nullable: false),
State = table.Column<string>(type: "nvarchar(max)", nullable: true),
PostalCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
Country = table.Column<string>(type: "nvarchar(max)", nullable: false),
CVR = table.Column<string>(type: "nvarchar(max)", nullable: true),
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
Mobile = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Addresss", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Banners",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
Content = table.Column<string>(type: "nvarchar(max)", nullable: false),
LinkUrl = table.Column<string>(type: "nvarchar(max)", nullable: false),
ImageUrl = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Banners", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Footers",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Owner = table.Column<string>(type: "nvarchar(max)", nullable: false),
Content = table.Column<string>(type: "nvarchar(max)", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
UpdatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
LastUpdated = table.Column<DateTime>(type: "datetime2", nullable: false),
ImageUlr = table.Column<string>(type: "nvarchar(max)", nullable: false),
Sitecopyright = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Footers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SocialMedia",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Url = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SocialMedia", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Pages",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
Slug = table.Column<string>(type: "nvarchar(max)", nullable: true),
Content = table.Column<string>(type: "nvarchar(max)", nullable: false),
BannerId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Pages", x => x.Id);
table.ForeignKey(
name: "FK_Pages_Banners_BannerId",
column: x => x.BannerId,
principalTable: "Banners",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "FooterSocialMedias",
columns: table => new
{
FooterId = table.Column<int>(type: "int", nullable: false),
SocialId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_FooterSocialMedias", x => new { x.FooterId, x.SocialId });
table.ForeignKey(
name: "FK_FooterSocialMedias_Footers_FooterId",
column: x => x.FooterId,
principalTable: "Footers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_FooterSocialMedias_SocialMedia_SocialId",
column: x => x.SocialId,
principalTable: "SocialMedia",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_FooterSocialMedias_SocialId",
table: "FooterSocialMedias",
column: "SocialId");
migrationBuilder.CreateIndex(
name: "IX_Pages_BannerId",
table: "Pages",
column: "BannerId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Addresss");
migrationBuilder.DropTable(
name: "FooterSocialMedias");
migrationBuilder.DropTable(
name: "Pages");
migrationBuilder.DropTable(
name: "Footers");
migrationBuilder.DropTable(
name: "SocialMedia");
migrationBuilder.DropTable(
name: "Banners");
}
}
}