20220816163313_Traits.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. #nullable disable
  3. namespace Content.Server.Database.Migrations.Sqlite
  4. {
  5. public partial class Traits : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.CreateTable(
  10. name: "trait",
  11. columns: table => new
  12. {
  13. trait_id = table.Column<int>(type: "INTEGER", nullable: false)
  14. .Annotation("Sqlite:Autoincrement", true),
  15. profile_id = table.Column<int>(type: "INTEGER", nullable: false),
  16. trait_name = table.Column<string>(type: "TEXT", nullable: false)
  17. },
  18. constraints: table =>
  19. {
  20. table.PrimaryKey("PK_trait", x => x.trait_id);
  21. table.ForeignKey(
  22. name: "FK_trait_profile_profile_id",
  23. column: x => x.profile_id,
  24. principalTable: "profile",
  25. principalColumn: "profile_id",
  26. onDelete: ReferentialAction.Cascade);
  27. });
  28. migrationBuilder.CreateIndex(
  29. name: "IX_trait_profile_id",
  30. table: "trait",
  31. column: "profile_id");
  32. }
  33. protected override void Down(MigrationBuilder migrationBuilder)
  34. {
  35. migrationBuilder.DropTable(
  36. name: "trait");
  37. }
  38. }
  39. }