using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Web.Migrations { /// public partial class Initial : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Addresss", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Street = table.Column(type: "nvarchar(max)", nullable: false), City = table.Column(type: "nvarchar(max)", nullable: false), State = table.Column(type: "nvarchar(max)", nullable: true), PostalCode = table.Column(type: "nvarchar(max)", nullable: false), Country = table.Column(type: "nvarchar(max)", nullable: false), CVR = table.Column(type: "nvarchar(max)", nullable: true), Email = table.Column(type: "nvarchar(max)", nullable: false), Mobile = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Addresss", x => x.Id); }); migrationBuilder.CreateTable( name: "Banners", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Title = table.Column(type: "nvarchar(max)", nullable: false), Description = table.Column(type: "nvarchar(max)", nullable: false), Content = table.Column(type: "nvarchar(max)", nullable: false), LinkUrl = table.Column(type: "nvarchar(max)", nullable: false), ImageUrl = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Banners", x => x.Id); }); migrationBuilder.CreateTable( name: "Footers", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Title = table.Column(type: "nvarchar(max)", nullable: false), Name = table.Column(type: "nvarchar(max)", nullable: false), Owner = table.Column(type: "nvarchar(max)", nullable: false), Content = table.Column(type: "nvarchar(max)", nullable: false), CreatedBy = table.Column(type: "nvarchar(max)", nullable: false), UpdatedBy = table.Column(type: "nvarchar(max)", nullable: false), LastUpdated = table.Column(type: "datetime2", nullable: false), ImageUlr = table.Column(type: "nvarchar(max)", nullable: false), Sitecopyright = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Footers", x => x.Id); }); migrationBuilder.CreateTable( name: "SocialMedia", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Name = table.Column(type: "nvarchar(max)", nullable: false), Url = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SocialMedia", x => x.Id); }); migrationBuilder.CreateTable( name: "Pages", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Title = table.Column(type: "nvarchar(max)", nullable: false), Slug = table.Column(type: "nvarchar(max)", nullable: true), Content = table.Column(type: "nvarchar(max)", nullable: false), BannerId = table.Column(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(type: "int", nullable: false), SocialId = table.Column(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"); } /// 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"); } } }