using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace DD.Persistence.Database.Postgres.Migrations.PersistencePostgres { /// public partial class TechMessageMigration : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "DataSourceSystem", columns: table => new { SystemId = table.Column(type: "uuid", nullable: false, comment: "Id системы - источника данных"), Name = table.Column(type: "varchar(256)", nullable: false, comment: "Наименование системы - источника данных"), Description = table.Column(type: "text", nullable: true, comment: "Описание системы - источника данных") }, constraints: table => { table.PrimaryKey("PK_DataSourceSystem", x => x.SystemId); }); migrationBuilder.CreateTable( name: "TechMessage", columns: table => new { EventId = table.Column(type: "uuid", nullable: false, comment: "Id события"), CategoryId = table.Column(type: "integer", nullable: false, comment: "Id Категории важности"), Timestamp = table.Column(type: "timestamp with time zone", nullable: false, comment: "Дата возникновения"), Text = table.Column(type: "varchar(512)", nullable: false, comment: "Текст сообщения"), SystemId = table.Column(type: "uuid", nullable: false, comment: "Id системы, к которой относится сообщение"), EventState = table.Column(type: "integer", nullable: false, comment: "Статус события") }, constraints: table => { table.PrimaryKey("PK_TechMessage", x => x.EventId); table.ForeignKey( name: "FK_TechMessage_DataSourceSystem_SystemId", column: x => x.SystemId, principalTable: "DataSourceSystem", principalColumn: "SystemId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_TechMessage_SystemId", table: "TechMessage", column: "SystemId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "TechMessage"); migrationBuilder.DropTable( name: "DataSourceSystem"); } } }