88 lines
4.8 KiB
C#
88 lines
4.8 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace FileService.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class InitFileDb : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterDatabase()
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "upload_files",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
OwnerId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
FileName = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
FileSize = table.Column<long>(type: "bigint", nullable: false),
|
|
ContentType = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
State = table.Column<int>(type: "int", nullable: false),
|
|
checksum_algorithm = table.Column<string>(type: "longtext", nullable: false),
|
|
checksum_value = table.Column<string>(type: "longtext", nullable: false),
|
|
storage_bucket = table.Column<string>(type: "longtext", nullable: false),
|
|
storage_key = table.Column<string>(type: "longtext", nullable: false),
|
|
storage_region = table.Column<string>(type: "longtext", nullable: true),
|
|
storage_provider = table.Column<string>(type: "longtext", nullable: false),
|
|
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
CreationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: false),
|
|
Deletion = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true),
|
|
ModificationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_upload_files", x => x.Id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "upload_tasks",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
UploaderId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
ConversationId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
FileName = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
FileSize = table.Column<long>(type: "bigint", nullable: false),
|
|
ContentType = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
State = table.Column<int>(type: "int", nullable: false),
|
|
checksum_algorithm = table.Column<string>(type: "longtext", nullable: false),
|
|
checksum_value = table.Column<string>(type: "longtext", nullable: false),
|
|
storage_bucket = table.Column<string>(type: "longtext", nullable: false),
|
|
storage_key = table.Column<string>(type: "longtext", nullable: false),
|
|
storage_region = table.Column<string>(type: "longtext", nullable: true),
|
|
storage_provider = table.Column<string>(type: "longtext", nullable: false),
|
|
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
CreationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: false),
|
|
Deletion = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true),
|
|
ModificationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_upload_tasks", x => x.Id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "upload_files");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "upload_tasks");
|
|
}
|
|
}
|
|
}
|