SeemGen/Migrations/20250114005435_AddDefaultUs...

184 lines
9.3 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BLAIzor.Migrations
{
/// <inheritdoc />
public partial class AddDefaultUser : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DesignTemplates",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
TemplateName = table.Column<string>(type: "nvarchar(max)", nullable: true),
TemplatePhotoUrl = table.Column<string>(type: "nvarchar(max)", nullable: true),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
Tags = table.Column<string>(type: "nvarchar(max)", nullable: true),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
Version = table.Column<int>(type: "int", nullable: false),
IsDeprecated = table.Column<bool>(type: "bit", nullable: false),
IsPrivate = table.Column<bool>(type: "bit", nullable: false),
IsPublished = table.Column<bool>(type: "bit", nullable: false),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
Status = table.Column<string>(type: "nvarchar(max)", nullable: false),
QDrandCollectionName = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DesignTemplates", x => x.Id);
table.ForeignKey(
name: "FK_DesignTemplates_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CssTemplates",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DesignTemplateId = table.Column<int>(type: "int", nullable: false),
CssContent = table.Column<string>(type: "nvarchar(max)", nullable: false),
LastUpdated = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CssTemplates", x => x.Id);
table.ForeignKey(
name: "FK_CssTemplates_DesignTemplates_DesignTemplateId",
column: x => x.DesignTemplateId,
principalTable: "DesignTemplates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "SiteInfos",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
SiteName = table.Column<string>(type: "nvarchar(max)", nullable: true),
BrandLogoUrl = table.Column<string>(type: "nvarchar(max)", nullable: true),
DefaultColor = table.Column<string>(type: "nvarchar(max)", nullable: true),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
DomainUrl = table.Column<string>(type: "nvarchar(max)", nullable: false),
DefaultUrl = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsPublished = table.Column<bool>(type: "bit", nullable: false),
TemplateId = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_SiteInfos", x => x.Id);
table.ForeignKey(
name: "FK_SiteInfos_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_SiteInfos_DesignTemplates_TemplateId",
column: x => x.TemplateId,
principalTable: "DesignTemplates",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "MenuItems",
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),
SortOrder = table.Column<int>(type: "int", nullable: false),
QdrantPointId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
SiteInfoId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_MenuItems", x => x.Id);
table.ForeignKey(
name: "FK_MenuItems_SiteInfos_SiteInfoId",
column: x => x.SiteInfoId,
principalTable: "SiteInfos",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "AspNetUsers",
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName" },
values: new object[] { "0988758e-e16c-4c2c-8c1e-efa3ac5f0274", 0, "a2836246-0303-4370-b283-e53a9a3f2813", "adam.g@aycode.com", true, false, null, "ADAM.G@AYCODE.COM", "ADAM.G@AYCODE.COM", "AQAAAAIAAYagAAAAEChxKCu+ReGvcZFR/6kPASbpnQdMp1MJuepeRyR4bfHTkUk8SfNAqmckGXvuw+GaGA==", null, false, "7ecf121a-b0e7-4e30-a1f1-299eeaf0a9cc", false, "adam.g@aycode.com" });
migrationBuilder.InsertData(
table: "DesignTemplates",
columns: new[] { "Id", "CreatedAt", "Description", "IsDeprecated", "IsPrivate", "IsPublished", "QDrandCollectionName", "Status", "Tags", "TemplateName", "TemplatePhotoUrl", "UpdatedAt", "UserId", "Version" },
values: new object[] { 1, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "The default template", false, false, false, "html_snippets", "Draft", "system", "Default Site", "/images/default-logo.png", null, "0988758e-e16c-4c2c-8c1e-efa3ac5f0274", 1 });
migrationBuilder.InsertData(
table: "SiteInfos",
columns: new[] { "Id", "BrandLogoUrl", "DefaultColor", "DefaultUrl", "DomainUrl", "IsPublished", "SiteName", "TemplateId", "UserId" },
values: new object[] { 1, "/images/default-logo.png", "#FFFFFF", "https://ai.poppixel.cloud", "poppixel.cloud", false, "Default Site", 1, "0988758e-e16c-4c2c-8c1e-efa3ac5f0274" });
migrationBuilder.CreateIndex(
name: "IX_CssTemplates_DesignTemplateId",
table: "CssTemplates",
column: "DesignTemplateId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_DesignTemplates_UserId",
table: "DesignTemplates",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_MenuItems_SiteInfoId",
table: "MenuItems",
column: "SiteInfoId");
migrationBuilder.CreateIndex(
name: "IX_SiteInfos_TemplateId",
table: "SiteInfos",
column: "TemplateId");
migrationBuilder.CreateIndex(
name: "IX_SiteInfos_UserId",
table: "SiteInfos",
column: "UserId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CssTemplates");
migrationBuilder.DropTable(
name: "MenuItems");
migrationBuilder.DropTable(
name: "SiteInfos");
migrationBuilder.DropTable(
name: "DesignTemplates");
migrationBuilder.DeleteData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "0988758e-e16c-4c2c-8c1e-efa3ac5f0274");
}
}
}