142 lines
7.2 KiB
C#
142 lines
7.2 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Hutopy.Modules.Creators.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Initial : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.EnsureSchema(
|
|
name: "Creators");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Creators",
|
|
schema: "Creators",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
CreatedBy = table.Column<Guid>(type: "uuid", nullable: false),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
DeletedBy = table.Column<Guid>(type: "uuid", nullable: true),
|
|
DeletedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
IsDeleted = table.Column<bool>(type: "boolean", nullable: false, computedColumnSql: "\"DeletedAt\" IS NOT NULL", stored: true),
|
|
BannerUrl = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
|
PortraitUrl = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
|
Verified = table.Column<bool>(type: "boolean", nullable: false),
|
|
Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
|
Slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
|
Title = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
|
StripeAccountId = table.Column<string>(type: "character varying(21)", maxLength: 21, nullable: true),
|
|
IsStripeOnboardingComplete = table.Column<bool>(type: "boolean", nullable: false),
|
|
IsStripePayoutReady = table.Column<bool>(type: "boolean", nullable: false),
|
|
IsStripeChargesEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
|
AcceptDonation = table.Column<bool>(type: "boolean", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Creators", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Slugs",
|
|
schema: "Creators",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
CreatedBy = table.Column<Guid>(type: "uuid", nullable: false),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
UsedBy = table.Column<Guid>(type: "uuid", nullable: true),
|
|
Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
|
NormalizedName = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, computedColumnSql: "LOWER(\"Name\")", stored: true),
|
|
ReservedUntil = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Slugs", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Presentation",
|
|
schema: "Creators",
|
|
columns: table => new
|
|
{
|
|
CreatorId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Description = table.Column<string>(type: "text", nullable: false),
|
|
VideoUrl = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
|
PhoneNumber = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
|
Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Presentation", x => x.CreatorId);
|
|
table.ForeignKey(
|
|
name: "FK_Presentation_Creators_CreatorId",
|
|
column: x => x.CreatorId,
|
|
principalSchema: "Creators",
|
|
principalTable: "Creators",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Socials",
|
|
schema: "Creators",
|
|
columns: table => new
|
|
{
|
|
CreatorId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
FacebookUrl = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
|
InstagramUrl = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
|
XUrl = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
|
LinkedInUrl = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
|
TikTokUrl = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
|
YoutubeUrl = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
|
RedditUrl = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
|
WebsiteUrl = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Socials", x => x.CreatorId);
|
|
table.ForeignKey(
|
|
name: "FK_Socials_Creators_CreatorId",
|
|
column: x => x.CreatorId,
|
|
principalSchema: "Creators",
|
|
principalTable: "Creators",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Slugs_NormalizedName",
|
|
schema: "Creators",
|
|
table: "Slugs",
|
|
column: "NormalizedName",
|
|
unique: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Presentation",
|
|
schema: "Creators");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Slugs",
|
|
schema: "Creators");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Socials",
|
|
schema: "Creators");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Creators",
|
|
schema: "Creators");
|
|
}
|
|
}
|
|
}
|