using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Hutopy.Infrastructure.Migrations
{
///
public partial class AddSocialNetworksToUser : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ApplicationUser_SocialNetworks",
columns: table => new
{
ApplicationUserId = table.Column(type: "nvarchar(450)", nullable: false),
FacebookUrl = table.Column(type: "nvarchar(max)", nullable: false),
InstagramUrl = table.Column(type: "nvarchar(max)", nullable: false),
XUrl = table.Column(type: "nvarchar(max)", nullable: false),
LinkedInUrl = table.Column(type: "nvarchar(max)", nullable: false),
TikTokUrl = table.Column(type: "nvarchar(max)", nullable: false),
YoutubeUrl = table.Column(type: "nvarchar(max)", nullable: false),
RedditUrl = table.Column(type: "nvarchar(max)", nullable: false),
YourWebsiteUrl = table.Column(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApplicationUser_SocialNetworks", x => x.ApplicationUserId);
table.ForeignKey(
name: "FK_ApplicationUser_SocialNetworks_AspNetUsers_ApplicationUserId",
column: x => x.ApplicationUserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.Sql(@"
INSERT INTO ApplicationUser_SocialNetworks (ApplicationUserId, FacebookUrl, InstagramUrl, XUrl, LinkedInUrl, TikTokUrl, YoutubeUrl, RedditUrl, YourWebsiteUrl)
SELECT Id, '', '', '', '', '', '', '', ''
FROM AspNetUsers
");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ApplicationUser_SocialNetworks");
}
}
}