using System.Text.Json; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace Content.Server.Database.Migrations.Postgres { /// public partial class CosmaticDriftCharacterRecords : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "cdprofile", columns: table => new { cdprofile_id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), profile_id = table.Column(type: "integer", nullable: false), height = table.Column(type: "real", nullable: false), character_records = table.Column(type: "jsonb", nullable: true) }, constraints: table => { table.PrimaryKey("PK_cdprofile", x => x.cdprofile_id); table.ForeignKey( name: "FK_cdprofile_profile_profile_id", column: x => x.profile_id, principalTable: "profile", principalColumn: "profile_id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "cd_character_record_entries", columns: table => new { cd_character_record_entries_id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), title = table.Column(type: "text", nullable: false), involved = table.Column(type: "text", nullable: false), description = table.Column(type: "text", nullable: false), type = table.Column(type: "smallint", nullable: false), cdprofile_id = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_cd_character_record_entries", x => x.cd_character_record_entries_id); table.ForeignKey( name: "FK_cd_character_record_entries_cdprofile_cdprofile_id", column: x => x.cdprofile_id, principalTable: "cdprofile", principalColumn: "cdprofile_id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_cd_character_record_entries_cd_character_record_entries_id", table: "cd_character_record_entries", column: "cd_character_record_entries_id"); migrationBuilder.CreateIndex( name: "IX_cd_character_record_entries_cdprofile_id", table: "cd_character_record_entries", column: "cdprofile_id"); migrationBuilder.CreateIndex( name: "IX_cdprofile_profile_id", table: "cdprofile", column: "profile_id", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "cd_character_record_entries"); migrationBuilder.DropTable( name: "cdprofile"); } } }