using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace comissions.app.api.Migrations { /// public partial class namingfixes : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_ArtistPortfolioPieces_ArtistServices_ArtistServiceId", table: "ArtistPortfolioPieces"); migrationBuilder.DropTable( name: "ArtistServiceOrderReviews"); migrationBuilder.DropTable( name: "ArtistServiceOrders"); migrationBuilder.DropTable( name: "ArtistServices"); migrationBuilder.DropIndex( name: "IX_ArtistPortfolioPieces_ArtistServiceId", table: "ArtistPortfolioPieces"); migrationBuilder.DropColumn( name: "ArtistServiceId", table: "ArtistPortfolioPieces"); migrationBuilder.CreateTable( name: "Requests", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Message = table.Column(type: "text", nullable: false), Amount = table.Column(type: "numeric", nullable: false), UserId = table.Column(type: "text", nullable: false), ArtistId = table.Column(type: "integer", nullable: false), RequestDate = table.Column(type: "timestamp with time zone", nullable: false), Accepted = table.Column(type: "boolean", nullable: false), AcceptedDate = table.Column(type: "timestamp with time zone", nullable: true), Declined = table.Column(type: "boolean", nullable: false), DeclinedDate = table.Column(type: "timestamp with time zone", nullable: true), Completed = table.Column(type: "boolean", nullable: false), CompletedDate = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Requests", x => x.Id); table.ForeignKey( name: "FK_Requests_UserArtists_ArtistId", column: x => x.ArtistId, principalTable: "UserArtists", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Requests_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Requests_ArtistId", table: "Requests", column: "ArtistId"); migrationBuilder.CreateIndex( name: "IX_Requests_UserId", table: "Requests", column: "UserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Requests"); migrationBuilder.AddColumn( name: "ArtistServiceId", table: "ArtistPortfolioPieces", type: "integer", nullable: true); migrationBuilder.CreateTable( name: "ArtistServices", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), ArtistId = table.Column(type: "integer", nullable: false), Archived = table.Column(type: "boolean", nullable: false), Description = table.Column(type: "text", nullable: false), Name = table.Column(type: "text", nullable: false), Price = table.Column(type: "double precision", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ArtistServices", x => x.Id); table.ForeignKey( name: "FK_ArtistServices_UserArtists_ArtistId", column: x => x.ArtistId, principalTable: "UserArtists", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "ArtistServiceOrders", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), ArtistId = table.Column(type: "integer", nullable: false), ArtistServiceId = table.Column(type: "integer", nullable: false), BuyerId = table.Column(type: "text", nullable: false), CreatedDate = table.Column(type: "timestamp with time zone", nullable: false), EndDate = table.Column(type: "timestamp with time zone", nullable: true), PaymentUrl = table.Column(type: "text", nullable: true), Price = table.Column(type: "double precision", nullable: false), Status = table.Column(type: "integer", nullable: false), TermsAcceptedDate = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_ArtistServiceOrders", x => x.Id); table.ForeignKey( name: "FK_ArtistServiceOrders_ArtistServices_ArtistServiceId", column: x => x.ArtistServiceId, principalTable: "ArtistServices", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ArtistServiceOrders_UserArtists_ArtistId", column: x => x.ArtistId, principalTable: "UserArtists", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ArtistServiceOrders_Users_BuyerId", column: x => x.BuyerId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "ArtistServiceOrderReviews", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), ArtistServiceId = table.Column(type: "integer", nullable: false), ArtistServiceOrderId = table.Column(type: "integer", nullable: false), ReviewerId = table.Column(type: "text", nullable: false), Rating = table.Column(type: "integer", nullable: false), Review = table.Column(type: "text", nullable: true), ReviewDate = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ArtistServiceOrderReviews", x => x.Id); table.ForeignKey( name: "FK_ArtistServiceOrderReviews_ArtistServiceOrders_ArtistService~", column: x => x.ArtistServiceOrderId, principalTable: "ArtistServiceOrders", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ArtistServiceOrderReviews_ArtistServices_ArtistServiceId", column: x => x.ArtistServiceId, principalTable: "ArtistServices", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ArtistServiceOrderReviews_Users_ReviewerId", column: x => x.ReviewerId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_ArtistPortfolioPieces_ArtistServiceId", table: "ArtistPortfolioPieces", column: "ArtistServiceId"); migrationBuilder.CreateIndex( name: "IX_ArtistServiceOrderReviews_ArtistServiceId", table: "ArtistServiceOrderReviews", column: "ArtistServiceId"); migrationBuilder.CreateIndex( name: "IX_ArtistServiceOrderReviews_ArtistServiceOrderId", table: "ArtistServiceOrderReviews", column: "ArtistServiceOrderId"); migrationBuilder.CreateIndex( name: "IX_ArtistServiceOrderReviews_ReviewerId", table: "ArtistServiceOrderReviews", column: "ReviewerId"); migrationBuilder.CreateIndex( name: "IX_ArtistServiceOrders_ArtistId", table: "ArtistServiceOrders", column: "ArtistId"); migrationBuilder.CreateIndex( name: "IX_ArtistServiceOrders_ArtistServiceId", table: "ArtistServiceOrders", column: "ArtistServiceId"); migrationBuilder.CreateIndex( name: "IX_ArtistServiceOrders_BuyerId", table: "ArtistServiceOrders", column: "BuyerId"); migrationBuilder.CreateIndex( name: "IX_ArtistServices_ArtistId", table: "ArtistServices", column: "ArtistId"); migrationBuilder.AddForeignKey( name: "FK_ArtistPortfolioPieces_ArtistServices_ArtistServiceId", table: "ArtistPortfolioPieces", column: "ArtistServiceId", principalTable: "ArtistServices", principalColumn: "Id"); } } }