192 lines
7.5 KiB
C#
192 lines
7.5 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
|
|
|
namespace Distribution.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class RouteOptionalFieldsAndStoreContactNumber : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "StoreKycDocuments");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "KycStatus",
|
|
table: "Stores");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "StartPoint",
|
|
table: "Routes",
|
|
type: "longtext",
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "longtext")
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AlterColumn<decimal>(
|
|
name: "Length",
|
|
table: "Routes",
|
|
type: "decimal(65,30)",
|
|
nullable: true,
|
|
oldClrType: typeof(decimal),
|
|
oldType: "decimal(65,30)");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "EndPoint",
|
|
table: "Routes",
|
|
type: "longtext",
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "longtext")
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "KycStatus",
|
|
table: "Stores",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Routes",
|
|
keyColumn: "StartPoint",
|
|
keyValue: null,
|
|
column: "StartPoint",
|
|
value: "");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "StartPoint",
|
|
table: "Routes",
|
|
type: "longtext",
|
|
nullable: false,
|
|
oldClrType: typeof(string),
|
|
oldType: "longtext",
|
|
oldNullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AlterColumn<decimal>(
|
|
name: "Length",
|
|
table: "Routes",
|
|
type: "decimal(65,30)",
|
|
nullable: false,
|
|
defaultValue: 0m,
|
|
oldClrType: typeof(decimal),
|
|
oldType: "decimal(65,30)",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Routes",
|
|
keyColumn: "EndPoint",
|
|
keyValue: null,
|
|
column: "EndPoint",
|
|
value: "");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "EndPoint",
|
|
table: "Routes",
|
|
type: "longtext",
|
|
nullable: false,
|
|
oldClrType: typeof(string),
|
|
oldType: "longtext",
|
|
oldNullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "StoreKycDocuments",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
FK_StoreId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
DocumentType = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
FileReference = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
UploadedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_StoreKycDocuments", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_StoreKycDocuments_Stores_FK_StoreId",
|
|
column: x => x.FK_StoreId,
|
|
principalTable: "Stores",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "StoreKycDocuments",
|
|
columns: new[] { "Id", "CreatedAt", "DocumentType", "FK_StoreId", "FileReference", "IsActive", "UploadedAt" },
|
|
values: new object[,]
|
|
{
|
|
{ new Guid("63000000-0000-0000-0000-000000000001"), new DateTime(2026, 8, 10, 0, 0, 0, 0, DateTimeKind.Unspecified), "Business Registration", new Guid("26000000-0000-0000-0000-000000000001"), "seed/kyc/fort-mini-mart-brc.pdf", true, new DateTime(2026, 8, 10, 0, 0, 0, 0, DateTimeKind.Unspecified) },
|
|
{ new Guid("63000000-0000-0000-0000-000000000002"), new DateTime(2026, 8, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), "NIC", new Guid("26000000-0000-0000-0000-000000000003"), "seed/kyc/wattala-owner-nic.pdf", true, new DateTime(2026, 8, 12, 0, 0, 0, 0, DateTimeKind.Unspecified) }
|
|
});
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Stores",
|
|
keyColumn: "Id",
|
|
keyValue: new Guid("26000000-0000-0000-0000-000000000001"),
|
|
column: "KycStatus",
|
|
value: 1);
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Stores",
|
|
keyColumn: "Id",
|
|
keyValue: new Guid("26000000-0000-0000-0000-000000000002"),
|
|
column: "KycStatus",
|
|
value: 1);
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Stores",
|
|
keyColumn: "Id",
|
|
keyValue: new Guid("26000000-0000-0000-0000-000000000003"),
|
|
column: "KycStatus",
|
|
value: 0);
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Stores",
|
|
keyColumn: "Id",
|
|
keyValue: new Guid("26000000-0000-0000-0000-000000000004"),
|
|
column: "KycStatus",
|
|
value: 0);
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Stores",
|
|
keyColumn: "Id",
|
|
keyValue: new Guid("26000000-0000-0000-0000-000000000005"),
|
|
column: "KycStatus",
|
|
value: 1);
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Stores",
|
|
keyColumn: "Id",
|
|
keyValue: new Guid("26000000-0000-0000-0000-000000000006"),
|
|
column: "KycStatus",
|
|
value: 0);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_StoreKycDocuments_FK_StoreId",
|
|
table: "StoreKycDocuments",
|
|
column: "FK_StoreId");
|
|
}
|
|
}
|
|
}
|