DocSpace-client/migrations/mysql/FeedDbContext/20220724114543_FeedDbContextMigrate.cs

129 lines
5.9 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ASC.Migrations.MySql.Migrations
{
public partial class FeedDbContextMigrate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "feed_aggregate",
columns: table => new
{
id = table.Column<string>(type: "varchar(88)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
tenant = table.Column<int>(type: "int", nullable: false),
product = table.Column<string>(type: "varchar(50)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
module = table.Column<string>(type: "varchar(50)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
author = table.Column<string>(type: "char(38)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
modified_by = table.Column<string>(type: "char(38)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
created_date = table.Column<DateTime>(type: "datetime", nullable: false),
modified_date = table.Column<DateTime>(type: "datetime", nullable: false),
group_id = table.Column<string>(type: "varchar(70)", nullable: true, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
aggregated_date = table.Column<DateTime>(type: "datetime", nullable: false),
json = table.Column<string>(type: "mediumtext", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
keywords = table.Column<string>(type: "text", nullable: true, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8")
},
constraints: table =>
{
table.PrimaryKey("PK_feed_aggregate", x => x.id);
})
.Annotation("MySql:CharSet", "utf8");
migrationBuilder.CreateTable(
name: "feed_last",
columns: table => new
{
last_key = table.Column<string>(type: "varchar(128)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
last_date = table.Column<DateTime>(type: "datetime", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => x.last_key);
})
.Annotation("MySql:CharSet", "utf8");
migrationBuilder.CreateTable(
name: "feed_readed",
columns: table => new
{
user_id = table.Column<string>(type: "varchar(38)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
module = table.Column<string>(type: "varchar(50)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
tenant_id = table.Column<int>(type: "int", nullable: false),
timestamp = table.Column<DateTime>(type: "datetime", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => new { x.tenant_id, x.user_id, x.module });
})
.Annotation("MySql:CharSet", "utf8");
migrationBuilder.CreateTable(
name: "feed_users",
columns: table => new
{
feed_id = table.Column<string>(type: "varchar(88)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
user_id = table.Column<string>(type: "char(38)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8")
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => new { x.feed_id, x.user_id });
})
.Annotation("MySql:CharSet", "utf8");
migrationBuilder.CreateIndex(
name: "aggregated_date",
table: "feed_aggregate",
columns: new[] { "tenant", "aggregated_date" });
migrationBuilder.CreateIndex(
name: "modified_date",
table: "feed_aggregate",
columns: new[] { "tenant", "modified_date" });
migrationBuilder.CreateIndex(
name: "product",
table: "feed_aggregate",
columns: new[] { "tenant", "product" });
migrationBuilder.CreateIndex(
name: "user_id",
table: "feed_users",
column: "user_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "feed_aggregate");
migrationBuilder.DropTable(
name: "feed_last");
migrationBuilder.DropTable(
name: "feed_readed");
migrationBuilder.DropTable(
name: "feed_users");
}
}
}