{
  "id": "migration-base-02-cache",
  "title": "Migration base 02 — cache",
  "description": "Estado atual das tabelas de cache e locks do Laravel.",
  "type": "migration-reference",
  "status": "implemented",
  "visibility": "public",
  "tags": [
    "sge/migrations",
    "sge/infraestrutura",
    "sge/banco-de-dados"
  ],
  "related": [],
  "sourceRefs": [
    "https://github.com/sge-suite/sge/blob/master/database/migrations/0001_01_01_000001_create_cache_table.php"
  ],
  "authors": [],
  "updated": null,
  "diagram": null,
  "body": "> [!success] Estado\n> Implementada no arquivo `0001_01_01_000001_create_cache_table.php`. É infraestrutura do Laravel, não entidade de negócio.\n\n## Tabelas criadas\n\n| Tabela        | Campos                                                             |\n| ------------- | ------------------------------------------------------------------ |\n| `cache`       | `key` string PK, `value` mediumText, `expiration` bigint indexado. |\n| `cache_locks` | `key` string PK, `owner` string, `expiration` bigint indexado.     |\n\n## Rollback atual\n\n`down()` remove `cache` e `cache_locks` com `dropIfExists()`.\n\n## Uso no SGE\n\nPode sustentar cache de permissões, rate limiting, sessões auxiliares e locks de Jobs. Não armazenar CPF, tokens, códigos ou conteúdo sensível sem política de expiração/proteção.\n\n## Checklist\n\n- [x] Criar as tabelas padrão.\n- [x] Criar índices de chave e expiração.\n- [ ] Confirmar driver de cache usado em desenvolvimento, testes e produção.\n- [ ] Documentar quais locks evitam duplicidade de Jobs.\n- [ ] Testar limpeza/expiração em ambiente controlado.\n- [ ] Evitar usar esta tabela como histórico; o histórico pertence às tabelas de domínio/auditoria.",
  "sections": [
    {
      "id": "tabelas-criadas",
      "level": 2,
      "title": "Tabelas criadas",
      "text": "| Tabela        | Campos                                                             | | ------------- | ------------------------------------------------------------------ | | `cache`       | `key` string PK, `value` mediumText, `expiration` bigint indexado. | | `cache_locks` | `key` string PK, `owner` string, `expiration` bigint indexado.     |",
      "line": 4
    },
    {
      "id": "rollback-atual",
      "level": 2,
      "title": "Rollback atual",
      "text": "`down()` remove `cache` e `cache_locks` com `dropIfExists()`.",
      "line": 11
    },
    {
      "id": "uso-no-sge",
      "level": 2,
      "title": "Uso no SGE",
      "text": "Pode sustentar cache de permissões, rate limiting, sessões auxiliares e locks de Jobs. Não armazenar CPF, tokens, códigos ou conteúdo sensível sem política de expiração/proteção.",
      "line": 15
    },
    {
      "id": "checklist",
      "level": 2,
      "title": "Checklist",
      "text": "- [x] Criar as tabelas padrão. - [x] Criar índices de chave e expiração. - [ ] Confirmar driver de cache usado em desenvolvimento, testes e produção. - [ ] Documentar quais locks evitam duplicidade de Jobs. - [ ] Testar limpeza/expiração em ambiente controlado. - [ ] Evitar usar esta tabela como histórico; o histórico pertence às tabelas de domínio/auditoria.",
      "line": 19
    }
  ],
  "sourcePath": "content/migration-base-02-cache.md",
  "visuals": [],
  "apiVersion": 1
}
