DocSpace-client/common/ASC.Feed/Migrations/PostgreSql/FeedDbContextPostgreSql/20211012145329_FeedDbContextPostgreSql.cs

124 lines
5.7 KiB
C#
Raw Normal View History

namespace ASC.Feed.Migrations.PostgreSql.FeedDbContextPostgreSql
2020-10-06 11:39:44 +00:00
{
2021-10-12 14:54:11 +00:00
public partial class FeedDbContextPostgreSql : Migration
2020-10-06 11:39:44 +00:00
{
protected override void Up(MigrationBuilder migrationBuilder)
{
2021-10-12 14:54:11 +00:00
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
2020-10-12 19:39:23 +00:00
migrationBuilder.CreateTable(
2020-10-06 11:39:44 +00:00
name: "feed_aggregate",
columns: table => new
{
2021-03-09 17:56:57 +00:00
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"),
2020-10-06 11:39:44 +00:00
created_date = table.Column<DateTime>(type: "datetime", nullable: false),
modified_date = table.Column<DateTime>(type: "datetime", nullable: false),
2021-03-09 17:56:57 +00:00
group_id = table.Column<string>(type: "varchar(70)", nullable: true, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
2020-10-06 11:39:44 +00:00
aggregated_date = table.Column<DateTime>(type: "datetime", nullable: false),
2021-03-09 17:56:57 +00:00
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")
2020-10-06 11:39:44 +00:00
.Annotation("MySql:CharSet", "utf8")
},
constraints: table =>
{
2020-10-12 19:39:23 +00:00
table.PrimaryKey("PK_feed_aggregate", x => x.id);
2021-10-12 14:54:11 +00:00
})
.Annotation("MySql:CharSet", "utf8mb4");
2020-10-06 11:39:44 +00:00
2020-10-12 19:39:23 +00:00
migrationBuilder.CreateTable(
2020-10-06 11:39:44 +00:00
name: "feed_last",
columns: table => new
{
2021-03-09 17:56:57 +00:00
last_key = table.Column<string>(type: "varchar(128)", nullable: false, collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8"),
2020-10-06 11:39:44 +00:00
last_date = table.Column<DateTime>(type: "datetime", nullable: false)
},
constraints: table =>
{
2020-10-12 19:39:23 +00:00
table.PrimaryKey("PRIMARY", x => x.last_key);
2021-10-12 14:54:11 +00:00
})
.Annotation("MySql:CharSet", "utf8mb4");
2020-10-06 11:39:44 +00:00
2020-10-12 19:39:23 +00:00
migrationBuilder.CreateTable(
2020-10-06 11:39:44 +00:00
name: "feed_readed",
columns: table => new
{
2021-03-09 17:56:57 +00:00
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),
2020-10-06 11:39:44 +00:00
timestamp = table.Column<DateTime>(type: "datetime", nullable: false)
},
constraints: table =>
{
2020-10-12 19:39:23 +00:00
table.PrimaryKey("PRIMARY", x => new { x.tenant_id, x.user_id, x.module });
2021-10-12 14:54:11 +00:00
})
.Annotation("MySql:CharSet", "utf8mb4");
2020-10-06 11:39:44 +00:00
2020-10-12 19:39:23 +00:00
migrationBuilder.CreateTable(
2020-10-06 11:39:44 +00:00
name: "feed_users",
columns: table => new
{
2021-03-09 17:56:57 +00:00
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")
2020-10-06 11:39:44 +00:00
.Annotation("MySql:CharSet", "utf8")
},
constraints: table =>
{
2020-10-12 19:39:23 +00:00
table.PrimaryKey("PRIMARY", x => new { x.feed_id, x.user_id });
2021-10-12 14:54:11 +00:00
})
.Annotation("MySql:CharSet", "utf8mb4");
2020-10-06 11:39:44 +00:00
2020-10-12 19:39:23 +00:00
migrationBuilder.CreateIndex(
2020-10-06 11:39:44 +00:00
name: "aggregated_date",
table: "feed_aggregate",
columns: new[] { "tenant", "aggregated_date" });
2020-10-12 19:39:23 +00:00
migrationBuilder.CreateIndex(
2020-10-06 11:39:44 +00:00
name: "modified_date",
table: "feed_aggregate",
columns: new[] { "tenant", "modified_date" });
2020-10-12 19:39:23 +00:00
migrationBuilder.CreateIndex(
2020-10-06 11:39:44 +00:00
name: "product",
table: "feed_aggregate",
columns: new[] { "tenant", "product" });
2020-10-12 19:39:23 +00:00
migrationBuilder.CreateIndex(
2020-10-06 11:39:44 +00:00
name: "user_id",
table: "feed_users",
column: "user_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
2020-10-12 19:39:23 +00:00
migrationBuilder.DropTable(
2020-10-06 11:39:44 +00:00
name: "feed_aggregate");
2020-10-12 19:39:23 +00:00
migrationBuilder.DropTable(
2020-10-06 11:39:44 +00:00
name: "feed_last");
2020-10-12 19:39:23 +00:00
migrationBuilder.DropTable(
2020-10-06 11:39:44 +00:00
name: "feed_readed");
2020-10-12 19:39:23 +00:00
migrationBuilder.DropTable(
2020-10-06 11:39:44 +00:00
name: "feed_users");
}
}
}