Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

41 рядки
2.5KB

  1. <%
  2. '=======================================================================================================================
  3. ' MIGRATION: add_payload_to_jobs
  4. '=======================================================================================================================
  5. ' This migration was auto-generated. Add your migration logic below.
  6. '
  7. ' The migration object provides these helper methods:
  8. ' - migration.ExecuteSQL(sql) - Execute raw SQL
  9. ' - migration.CreateTable(name, columns) - Create a table
  10. ' - migration.DropTable(name) - Drop a table
  11. ' - migration.AddColumn(table, column, type) - Add a column
  12. ' - migration.DropColumn(table, column) - Drop a column
  13. ' - migration.CreateIndex(name, table, columns) - Create an index
  14. ' - migration.DropIndex(name, table) - Drop an index
  15. '
  16. ' For complex operations, use migration.DB to access the database directly:
  17. ' migration.DB.Execute "INSERT INTO users (name) VALUES (?)", Array("John")
  18. '
  19. '-----------------------------------------------------------------------------------------------------------------------
  20. ' UP - Apply the migration
  21. '-----------------------------------------------------------------------------------------------------------------------
  22. Sub Migration_Up(migration)
  23. ' Durable ingestion jobs (spec FR-016, NFR-002, AC-12): the normalized input is kept on the job until it succeeds,
  24. ' so an interrupted or failed job can be retried by the worker (core/lib.Jobs.asp).
  25. migration.AddColumn "jobs", "payload", "TEXT"
  26. migration.CreateIndex "idx_jobs_state", "jobs", "state, updated_at"
  27. ' Jobs left "running" by the old in-request code have no stored input and can never finish: close them.
  28. migration.ExecuteSQL "UPDATE jobs SET state = 'failed', error_code = 'interrupted', error_message = 'Interrupted before durable jobs existed; submit the document again.' WHERE state IN ('queued', 'running')"
  29. End Sub
  30. '-----------------------------------------------------------------------------------------------------------------------
  31. ' DOWN - Rollback the migration
  32. '-----------------------------------------------------------------------------------------------------------------------
  33. Sub Migration_Down(migration)
  34. ' Jobs closed by Up stay failed (their input never existed).
  35. migration.DropIndex "idx_jobs_state", "jobs"
  36. migration.DropColumn "jobs", "payload"
  37. End Sub
  38. %>

Powered by TurnKey Linux.