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(type: "varchar(88)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), tenant = table.Column(type: "int", nullable: false), product = table.Column(type: "varchar(50)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), module = table.Column(type: "varchar(50)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), author = table.Column(type: "char(38)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), modified_by = table.Column(type: "char(38)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), created_date = table.Column(type: "datetime", nullable: false), modified_date = table.Column(type: "datetime", nullable: false), group_id = table.Column(type: "varchar(70)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), aggregated_date = table.Column(type: "datetime", nullable: false), json = table.Column(type: "mediumtext", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), keywords = table.Column(type: "text", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), context_id = table.Column(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(type: "varchar(128)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), last_date = table.Column(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(type: "varchar(38)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), module = table.Column(type: "varchar(50)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), tenant_id = table.Column(type: "int", nullable: false), timestamp = table.Column(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(type: "varchar(88)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), user_id = table.Column(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"); } } }