using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace comissions.app.api.Migrations { /// public partial class Initial : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Users", columns: table => new { Id = table.Column(type: "text", nullable: false), DisplayName = table.Column(type: "text", nullable: false), Biography = table.Column(type: "text", nullable: false), Email = table.Column(type: "text", nullable: false), UserArtistId = table.Column(type: "integer", nullable: true), Banned = table.Column(type: "boolean", nullable: false), BannedDate = table.Column(type: "timestamp with time zone", nullable: true), UnbanDate = table.Column(type: "timestamp with time zone", nullable: true), BannedReason = table.Column(type: "text", nullable: true), BanAdminId = table.Column(type: "text", nullable: true), Suspended = table.Column(type: "boolean", nullable: false), SuspendedDate = table.Column(type: "timestamp with time zone", nullable: true), UnsuspendDate = table.Column(type: "timestamp with time zone", nullable: true), SuspendedReason = table.Column(type: "text", nullable: true), SuspendAdminId = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Users", x => x.Id); }); migrationBuilder.CreateTable( name: "ArtistRequests", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), UserId = table.Column(type: "text", nullable: false), RequestDate = table.Column(type: "timestamp with time zone", nullable: false), AcceptedDate = table.Column(type: "timestamp with time zone", nullable: true), Accepted = table.Column(type: "boolean", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ArtistRequests", x => x.Id); table.ForeignKey( name: "FK_ArtistRequests_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "UserArtists", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), UserId = table.Column(type: "text", nullable: false), Biography = table.Column(type: "text", nullable: false), SocialMediaLinks = table.Column>(type: "text[]", nullable: false), AgeRestricted = table.Column(type: "boolean", nullable: false), StripeAccountId = table.Column(type: "text", nullable: true), PrepaymentRequired = table.Column(type: "boolean", nullable: false), Suspended = table.Column(type: "boolean", nullable: false), SuspendedDate = table.Column(type: "timestamp with time zone", nullable: true), UnsuspendDate = table.Column(type: "timestamp with time zone", nullable: true), SuspendedReason = table.Column(type: "text", nullable: true), SuspendAdminId = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_UserArtists", x => x.Id); table.ForeignKey( name: "FK_UserArtists_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); 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), Name = table.Column(type: "text", nullable: false), Description = table.Column(type: "text", nullable: false), Price = table.Column(type: "double precision", nullable: false), Archived = table.Column(type: "boolean", 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: "ArtistPortfolioPieces", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), ArtistId = table.Column(type: "integer", nullable: false), FileReference = table.Column(type: "text", nullable: false), ArtistServiceId = table.Column(type: "integer", nullable: true) }, constraints: table => { table.PrimaryKey("PK_ArtistPortfolioPieces", x => x.Id); table.ForeignKey( name: "FK_ArtistPortfolioPieces_ArtistServices_ArtistServiceId", column: x => x.ArtistServiceId, principalTable: "ArtistServices", principalColumn: "Id"); table.ForeignKey( name: "FK_ArtistPortfolioPieces_UserArtists_ArtistProfi~", 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), BuyerId = table.Column(type: "text", nullable: false), ArtistServiceId = table.Column(type: "integer", nullable: false), ArtistId = table.Column(type: "integer", nullable: false), Status = table.Column(type: "integer", nullable: false), Price = table.Column(type: "double precision", nullable: false), CreatedDate = table.Column(type: "timestamp with time zone", nullable: false), TermsAcceptedDate = table.Column(type: "timestamp with time zone", nullable: true), EndDate = table.Column(type: "timestamp with time zone", nullable: true), PaymentUrl = table.Column(type: "text", 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), ReviewerId = table.Column(type: "text", nullable: false), ArtistServiceOrderId = table.Column(type: "integer", nullable: false), ArtistServiceId = table.Column(type: "integer", nullable: false), ReviewDate = table.Column(type: "timestamp with time zone", nullable: false), Review = table.Column(type: "text", nullable: true), Rating = table.Column(type: "integer", 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_ArtistId", table: "ArtistPortfolioPieces", column: "ArtistId"); migrationBuilder.CreateIndex( name: "IX_ArtistPortfolioPieces_ArtistServiceId", table: "ArtistPortfolioPieces", column: "ArtistServiceId"); migrationBuilder.CreateIndex( name: "IX_ArtistRequests_UserId", table: "ArtistRequests", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_ArtistServiceOrderReviews_ReviewerId", table: "ArtistServiceOrderReviews", column: "ReviewerId"); migrationBuilder.CreateIndex( name: "IX_ArtistServiceOrderReviews_ArtistServiceId", table: "ArtistServiceOrderReviews", column: "ArtistServiceId"); migrationBuilder.CreateIndex( name: "IX_ArtistServiceOrderReviews_ArtistServiceOrderId", table: "ArtistServiceOrderReviews", column: "ArtistServiceOrderId"); migrationBuilder.CreateIndex( name: "IX_ArtistServiceOrders_BuyerId", table: "ArtistServiceOrders", column: "BuyerId"); migrationBuilder.CreateIndex( name: "IX_ArtistServiceOrders_ArtistId", table: "ArtistServiceOrders", column: "ArtistId"); migrationBuilder.CreateIndex( name: "IX_ArtistServiceOrders_ArtistServiceId", table: "ArtistServiceOrders", column: "ArtistServiceId"); migrationBuilder.CreateIndex( name: "IX_ArtistServices_ArtistId", table: "ArtistServices", column: "ArtistId"); migrationBuilder.CreateIndex( name: "IX_UserArtists_UserId", table: "UserArtists", column: "UserId", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ArtistPortfolioPieces"); migrationBuilder.DropTable( name: "ArtistRequests"); migrationBuilder.DropTable( name: "ArtistServiceOrderReviews"); migrationBuilder.DropTable( name: "ArtistServiceOrders"); migrationBuilder.DropTable( name: "ArtistServices"); migrationBuilder.DropTable( name: "UserArtists"); migrationBuilder.DropTable( name: "Users"); } } }