M0005_RawLog.vala 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using InvercargillSql.Migrations;
  2. namespace ClankerSaddle.Data.Migrations {
  3. /**
  4. * Web-stack raw terminal log: the daemon's PTY output chunks (GET
  5. * /log?since=), appended while a session is active. When a session
  6. * has rows here, the terminal view renders the concatenated raw log
  7. * instead of the typed entry stream (which older sessions keep
  8. * using). The (session_id, seq) pair is unique so poll retries can
  9. * never duplicate a chunk.
  10. */
  11. public class M0005_RawLog : Migration {
  12. public override string name { get { return "Raw log: session_raw_log"; } }
  13. public override uint64 serial { get { return 5; } }
  14. public override string migration_namespace { get { return "clanker-saddle"; } }
  15. public override void up(MigrationBuilder b) {
  16. b.create_table("session_raw_log", (t) => {
  17. t.column<int64?>("id")
  18. .auto_increment()
  19. .primary_key();
  20. t.column<int64?>("session_id")
  21. .not_null()
  22. .references("sessions", "id")
  23. .indexed();
  24. t.column<int64?>("seq")
  25. .not_null();
  26. t.column<string>("chunk")
  27. .not_null();
  28. t.unique("uq_session_raw_log_seq", {"session_id", "seq"});
  29. });
  30. }
  31. public override void down(MigrationBuilder b) {
  32. b.drop_table("session_raw_log");
  33. }
  34. }
  35. }