using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace DrinkRateAPI.Migrations { /// public partial class ObjectHistory : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "UpdateRecords", columns: table => new { Id = table.Column(type: "uuid", nullable: false), UserProfileId = table.Column(type: "uuid", nullable: false), UpdateTime = table.Column(type: "timestamp with time zone", nullable: false), DbCompanyId = table.Column(type: "uuid", nullable: true), DbCompanyRatingCompanyId = table.Column(type: "uuid", nullable: true), DbCompanyRatingUserProfileId = table.Column(type: "uuid", nullable: true), DbCompanyTableViewId = table.Column(type: "uuid", nullable: true), DbProductId = table.Column(type: "uuid", nullable: true), DbProductRatingProductId = table.Column(type: "uuid", nullable: true), DbProductRatingUserProfileId = table.Column(type: "uuid", nullable: true), DbProductTableViewId = table.Column(type: "uuid", nullable: true) }, constraints: table => { table.PrimaryKey("PK_UpdateRecords", x => x.Id); table.ForeignKey( name: "FK_UpdateRecords_Companies_DbCompanyId", column: x => x.DbCompanyId, principalTable: "Companies", principalColumn: "Id"); table.ForeignKey( name: "FK_UpdateRecords_CompanyRatings_DbCompanyRatingUserProfileId_D~", columns: x => new { x.DbCompanyRatingUserProfileId, x.DbCompanyRatingCompanyId }, principalTable: "CompanyRatings", principalColumns: new[] { "UserProfileId", "CompanyId" }); table.ForeignKey( name: "FK_UpdateRecords_CompanyTableViews_DbCompanyTableViewId", column: x => x.DbCompanyTableViewId, principalTable: "CompanyTableViews", principalColumn: "Id"); table.ForeignKey( name: "FK_UpdateRecords_ProductRating_DbProductRatingUserProfileId_Db~", columns: x => new { x.DbProductRatingUserProfileId, x.DbProductRatingProductId }, principalTable: "ProductRating", principalColumns: new[] { "UserProfileId", "ProductId" }); table.ForeignKey( name: "FK_UpdateRecords_ProductTableView_DbProductTableViewId", column: x => x.DbProductTableViewId, principalTable: "ProductTableView", principalColumn: "Id"); table.ForeignKey( name: "FK_UpdateRecords_Product_DbProductId", column: x => x.DbProductId, principalTable: "Product", principalColumn: "Id"); table.ForeignKey( name: "FK_UpdateRecords_UserProfiles_UserProfileId", column: x => x.UserProfileId, principalTable: "UserProfiles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "UpdateRecordFieldChanges", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Field = table.Column(type: "text", nullable: false), OldValue = table.Column(type: "text", nullable: false), NewValue = table.Column(type: "text", nullable: false), DbUpdateRecordId = table.Column(type: "uuid", nullable: true) }, constraints: table => { table.PrimaryKey("PK_UpdateRecordFieldChanges", x => x.Id); table.ForeignKey( name: "FK_UpdateRecordFieldChanges_UpdateRecords_DbUpdateRecordId", column: x => x.DbUpdateRecordId, principalTable: "UpdateRecords", principalColumn: "Id"); }); migrationBuilder.CreateIndex( name: "IX_UpdateRecordFieldChanges_DbUpdateRecordId", table: "UpdateRecordFieldChanges", column: "DbUpdateRecordId"); migrationBuilder.CreateIndex( name: "IX_UpdateRecords_DbCompanyId", table: "UpdateRecords", column: "DbCompanyId"); migrationBuilder.CreateIndex( name: "IX_UpdateRecords_DbCompanyRatingUserProfileId_DbCompanyRatingC~", table: "UpdateRecords", columns: new[] { "DbCompanyRatingUserProfileId", "DbCompanyRatingCompanyId" }); migrationBuilder.CreateIndex( name: "IX_UpdateRecords_DbCompanyTableViewId", table: "UpdateRecords", column: "DbCompanyTableViewId"); migrationBuilder.CreateIndex( name: "IX_UpdateRecords_DbProductId", table: "UpdateRecords", column: "DbProductId"); migrationBuilder.CreateIndex( name: "IX_UpdateRecords_DbProductRatingUserProfileId_DbProductRatingP~", table: "UpdateRecords", columns: new[] { "DbProductRatingUserProfileId", "DbProductRatingProductId" }); migrationBuilder.CreateIndex( name: "IX_UpdateRecords_DbProductTableViewId", table: "UpdateRecords", column: "DbProductTableViewId"); migrationBuilder.CreateIndex( name: "IX_UpdateRecords_UserProfileId", table: "UpdateRecords", column: "UserProfileId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "UpdateRecordFieldChanges"); migrationBuilder.DropTable( name: "UpdateRecords"); } } }