using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Hutopy.Web.Features.Contents.Migrations { /// public partial class Initial : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( name: "Content"); migrationBuilder.CreateTable( name: "Creators", schema: "Content", columns: table => new { Id = table.Column(type: "uuid", nullable: false), CreatedBy = table.Column(type: "uuid", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), About_Title = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), About_Description = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true) }, constraints: table => { table.PrimaryKey("PK_Creators", x => x.Id); }); migrationBuilder.CreateTable( name: "Contents", schema: "Content", columns: table => new { Id = table.Column(type: "uuid", nullable: false), CreatedBy = table.Column(type: "uuid", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), Title = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), Description = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: false), Urls = table.Column(type: "text[]", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Contents", x => x.Id); table.ForeignKey( name: "FK_Contents_Creators_CreatedBy", column: x => x.CreatedBy, principalSchema: "Content", principalTable: "Creators", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "ProfileColors", schema: "Content", columns: table => new { CreatorId = table.Column(type: "uuid", nullable: false), BannerTop = table.Column(type: "character varying(9)", maxLength: 9, nullable: true), BannerBottom = table.Column(type: "character varying(9)", maxLength: 9, nullable: true), Accent = table.Column(type: "character varying(9)", maxLength: 9, nullable: true), Menu = table.Column(type: "character varying(9)", maxLength: 9, nullable: true) }, constraints: table => { table.PrimaryKey("PK_ProfileColors", x => x.CreatorId); table.ForeignKey( name: "FK_ProfileColors_Creators_CreatorId", column: x => x.CreatorId, principalSchema: "Content", principalTable: "Creators", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "SocialNetworks", schema: "Content", columns: table => new { CreatorId = table.Column(type: "uuid", nullable: false), FacebookUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), InstagramUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), XUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), LinkedInUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), TikTokUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), YoutubeUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), RedditUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), WebsiteUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true) }, constraints: table => { table.PrimaryKey("PK_SocialNetworks", x => x.CreatorId); table.ForeignKey( name: "FK_SocialNetworks_Creators_CreatorId", column: x => x.CreatorId, principalSchema: "Content", principalTable: "Creators", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "StoredDataUrls", schema: "Content", columns: table => new { CreatorId = table.Column(type: "uuid", nullable: false), BannerPictureUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), ProfilePictureUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true) }, constraints: table => { table.PrimaryKey("PK_StoredDataUrls", x => x.CreatorId); table.ForeignKey( name: "FK_StoredDataUrls_Creators_CreatorId", column: x => x.CreatorId, principalSchema: "Content", principalTable: "Creators", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Subscriptions", schema: "Content", columns: table => new { CreatedBy = table.Column(type: "uuid", nullable: false), CreatorId = table.Column(type: "uuid", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Subscriptions", x => new { x.CreatedBy, x.CreatorId }); table.ForeignKey( name: "FK_Subscriptions_Creators_CreatorId", column: x => x.CreatorId, principalSchema: "Content", principalTable: "Creators", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Contents_CreatedBy", schema: "Content", table: "Contents", column: "CreatedBy"); migrationBuilder.CreateIndex( name: "IX_Subscriptions_CreatorId", schema: "Content", table: "Subscriptions", column: "CreatorId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Contents", schema: "Content"); migrationBuilder.DropTable( name: "ProfileColors", schema: "Content"); migrationBuilder.DropTable( name: "SocialNetworks", schema: "Content"); migrationBuilder.DropTable( name: "StoredDataUrls", schema: "Content"); migrationBuilder.DropTable( name: "Subscriptions", schema: "Content"); migrationBuilder.DropTable( name: "Creators", schema: "Content"); } } }