20220724000132_PlayTime.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
  4. #nullable disable
  5. namespace Content.Server.Database.Migrations.Postgres
  6. {
  7. public partial class PlayTime : Migration
  8. {
  9. protected override void Up(MigrationBuilder migrationBuilder)
  10. {
  11. migrationBuilder.CreateTable(
  12. name: "play_time",
  13. columns: table => new
  14. {
  15. play_time_id = table.Column<int>(type: "integer", nullable: false)
  16. .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
  17. player_id = table.Column<Guid>(type: "uuid", nullable: false),
  18. tracker = table.Column<string>(type: "text", nullable: false),
  19. time_spent = table.Column<TimeSpan>(type: "interval", nullable: false)
  20. },
  21. constraints: table =>
  22. {
  23. table.PrimaryKey("PK_play_time", x => x.play_time_id);
  24. });
  25. migrationBuilder.CreateIndex(
  26. name: "IX_play_time_player_id_tracker",
  27. table: "play_time",
  28. columns: new[] { "player_id", "tracker" },
  29. unique: true);
  30. }
  31. protected override void Down(MigrationBuilder migrationBuilder)
  32. {
  33. migrationBuilder.DropTable(
  34. name: "play_time");
  35. }
  36. }
  37. }