@wirecat/cli-core 0.752.0 → 1.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +162 -0
- package/README.md +9 -6
- package/dist/analysis/settings.d.ts +3 -1
- package/dist/analysis/settings.js +2 -1
- package/dist/attachments/extract.d.ts +1 -1
- package/dist/attachments/extract.js +1 -1
- package/dist/background/deliver.d.ts +3 -0
- package/dist/background/deliver.js +3 -0
- package/dist/background/lock.d.ts +1 -1
- package/dist/background/lock.js +1 -1
- package/dist/background/schedules.d.ts +13 -3
- package/dist/background/schedules.js +13 -3
- package/dist/background/when.d.ts +19 -5
- package/dist/background/when.js +17 -5
- package/dist/calendar/cli/answers.d.ts +1 -0
- package/dist/calendar/cli/answers.js +1 -0
- package/dist/calendar/cli/index.js +3 -1
- package/dist/calendar/feeds.d.ts +2 -0
- package/dist/calendar/feeds.js +10 -1
- package/dist/calendar/source.d.ts +5 -0
- package/dist/calendar/sync.d.ts +7 -1
- package/dist/calendar/sync.js +37 -7
- package/dist/calendar/testing/memory.js +7 -2
- package/dist/calendar/testing/sync-contract.js +2 -1
- package/dist/cli/account-rename.d.ts +3 -0
- package/dist/cli/account-rename.js +1 -0
- package/dist/cli/after-dashes.d.ts +1 -0
- package/dist/cli/after-dashes.js +1 -0
- package/dist/cli/agent-evaluation.d.ts +8 -1
- package/dist/cli/agent-evaluation.js +4 -1
- package/dist/cli/app-doctor-command.d.ts +1 -0
- package/dist/cli/app-doctor-command.js +1 -0
- package/dist/cli/ask-before-write.d.ts +1 -0
- package/dist/cli/ask-before-write.js +1 -0
- package/dist/cli/author.d.ts +1 -1
- package/dist/cli/author.js +1 -1
- package/dist/cli/base-stages-command.d.ts +2 -0
- package/dist/cli/base-stages-command.js +1 -0
- package/dist/cli/bot/api-http.d.ts +9 -3
- package/dist/cli/bot/api-http.js +7 -3
- package/dist/cli/bot/api-input.d.ts +3 -2
- package/dist/cli/bot/api-input.js +3 -2
- package/dist/cli/bot/api-rpc.d.ts +3 -1
- package/dist/cli/bot/api-rpc.js +2 -1
- package/dist/cli/bot/api.d.ts +1 -1
- package/dist/cli/bot/context.d.ts +3 -2
- package/dist/cli/bot/context.js +1 -1
- package/dist/cli/bot/copy.d.ts +1 -0
- package/dist/cli/bot/messages.d.ts +5 -2
- package/dist/cli/bot/messages.js +5 -2
- package/dist/cli/bot/port.d.ts +10 -6
- package/dist/cli/bot/port.js +1 -1
- package/dist/cli/bot/registry.d.ts +6 -3
- package/dist/cli/bot/registry.js +6 -3
- package/dist/cli/bot/updates.d.ts +2 -1
- package/dist/cli/bot/updates.js +2 -1
- package/dist/cli/call-stats-command.d.ts +3 -0
- package/dist/cli/call-stats-command.js +1 -0
- package/dist/cli/command-contract.d.ts +3 -0
- package/dist/cli/command-contract.js +2 -0
- package/dist/cli/command-runs.d.ts +3 -1
- package/dist/cli/command-runs.js +2 -1
- package/dist/cli/commander-internals.d.ts +16 -0
- package/dist/cli/commander-internals.js +17 -0
- package/dist/cli/commands-command.d.ts +1 -0
- package/dist/cli/commands-command.js +3 -1
- package/dist/cli/compact.d.ts +13 -8
- package/dist/cli/compact.js +9 -6
- package/dist/cli/config-command.d.ts +3 -3
- package/dist/cli/config-command.js +4 -4
- package/dist/cli/config-issues.d.ts +7 -3
- package/dist/cli/config-issues.js +7 -3
- package/dist/cli/config-keys.d.ts +4 -1
- package/dist/cli/config-keys.js +4 -1
- package/dist/cli/context.d.ts +6 -2
- package/dist/cli/context.js +5 -1
- package/dist/cli/contract-evidence.d.ts +1 -0
- package/dist/cli/contract-evidence.js +1 -0
- package/dist/cli/csv.d.ts +3 -2
- package/dist/cli/csv.js +3 -2
- package/dist/cli/default-config.d.ts +2 -0
- package/dist/cli/default-config.js +2 -0
- package/dist/cli/doctor-reports-command.d.ts +5 -1
- package/dist/cli/doctor-reports-command.js +4 -1
- package/dist/cli/documents/catalog.js +2 -1
- package/dist/cli/documents/file-conflicts.js +2 -1
- package/dist/cli/documents/file-edit.js +5 -4
- package/dist/cli/documents/file-mirrors.js +4 -3
- package/dist/cli/documents/file-update.js +2 -1
- package/dist/cli/documents/folders.js +2 -1
- package/dist/cli/early-refusal.d.ts +4 -4
- package/dist/cli/early-refusal.js +4 -4
- package/dist/cli/effects.d.ts +41 -11
- package/dist/cli/effects.js +48 -13
- package/dist/cli/entry.d.ts +4 -1
- package/dist/cli/entry.js +4 -1
- package/dist/cli/envelope.d.ts +14 -4
- package/dist/cli/envelope.js +14 -4
- package/dist/cli/execution.d.ts +1 -0
- package/dist/cli/execution.js +1 -0
- package/dist/cli/findings-input.d.ts +10 -2
- package/dist/cli/findings-input.js +10 -2
- package/dist/cli/first-run.d.ts +9 -2
- package/dist/cli/first-run.js +7 -1
- package/dist/cli/group-lock.d.ts +6 -0
- package/dist/cli/group-lock.js +5 -0
- package/dist/cli/guide.d.ts +5 -2
- package/dist/cli/guide.js +8 -4
- package/dist/cli/help/command-help.d.ts +12 -4
- package/dist/cli/help/command-help.js +13 -6
- package/dist/cli/help/first-screen.d.ts +2 -0
- package/dist/cli/help/first-screen.js +2 -0
- package/dist/cli/help/sections.d.ts +1 -0
- package/dist/cli/help/sections.js +1 -0
- package/dist/cli/index.d.ts +2 -1
- package/dist/cli/index.js +2 -1
- package/dist/cli/input-policy.d.ts +3 -0
- package/dist/cli/input-policy.js +3 -0
- package/dist/cli/json-fields.d.ts +1 -0
- package/dist/cli/json-fields.js +1 -0
- package/dist/cli/list-query.d.ts +11 -5
- package/dist/cli/list-query.js +11 -5
- package/dist/cli/listings.d.ts +13 -5
- package/dist/cli/listings.js +12 -5
- package/dist/cli/local-times.d.ts +3 -2
- package/dist/cli/local-times.js +2 -1
- package/dist/cli/mcp-server-command.d.ts +4 -1
- package/dist/cli/mcp-server-command.js +2 -0
- package/dist/cli/meeting-batch.d.ts +2 -1
- package/dist/cli/meeting-batch.js +2 -1
- package/dist/cli/meeting-evidence-answer.d.ts +2 -2
- package/dist/cli/meeting-evidence-answer.js +2 -2
- package/dist/cli/meeting-meaning-command.d.ts +5 -0
- package/dist/cli/meeting-meaning-command.js +2 -0
- package/dist/cli/meeting-passage-text.d.ts +1 -0
- package/dist/cli/meeting-passage-text.js +1 -0
- package/dist/cli/meeting-preparation-answer.d.ts +1 -0
- package/dist/cli/meeting-preparation-answer.js +1 -0
- package/dist/cli/meeting-preparation-read.d.ts +2 -0
- package/dist/cli/meeting-preparation-read.js +2 -0
- package/dist/cli/meeting-project-candidates-read.d.ts +1 -0
- package/dist/cli/meeting-project-candidates-read.js +1 -0
- package/dist/cli/meeting-results.d.ts +4 -1
- package/dist/cli/meeting-results.js +4 -1
- package/dist/cli/meeting-series-inventory-read.d.ts +2 -0
- package/dist/cli/meeting-series-inventory-read.js +1 -0
- package/dist/cli/meeting-tags-command.d.ts +2 -0
- package/dist/cli/meeting-tags-command.js +1 -0
- package/dist/cli/messenger/admin-folders-command.js +2 -1
- package/dist/cli/messenger/admin-moderation-command.d.ts +1 -1
- package/dist/cli/messenger/admin-moderation-command.js +1 -1
- package/dist/cli/messenger/ask.d.ts +1 -1
- package/dist/cli/messenger/ask.js +1 -1
- package/dist/cli/messenger/context.d.ts +2 -1
- package/dist/cli/messenger/context.js +1 -0
- package/dist/cli/messenger/doctor-command.d.ts +2 -1
- package/dist/cli/messenger/doctor-command.js +2 -1
- package/dist/cli/messenger/inbox.d.ts +2 -2
- package/dist/cli/messenger/inbox.js +2 -2
- package/dist/cli/messenger/lacks.d.ts +1 -0
- package/dist/cli/messenger/lacks.js +5 -3
- package/dist/cli/messenger/mcp-command.d.ts +8 -3
- package/dist/cli/messenger/mcp-command.js +6 -2
- package/dist/cli/messenger/message-items.d.ts +3 -1
- package/dist/cli/messenger/message-items.js +1 -0
- package/dist/cli/messenger/messages-delete-command.d.ts +1 -1
- package/dist/cli/messenger/messages-delete-command.js +1 -1
- package/dist/cli/messenger/report.d.ts +4 -1
- package/dist/cli/messenger/report.js +2 -0
- package/dist/cli/messenger/search-answers.d.ts +10 -4
- package/dist/cli/messenger/search-answers.js +6 -2
- package/dist/cli/messenger/searches-command.d.ts +4 -1
- package/dist/cli/messenger/searches-command.js +4 -1
- package/dist/cli/messenger/serve-command.d.ts +1 -1
- package/dist/cli/messenger/serve-command.js +1 -1
- package/dist/cli/messenger/serve-members.d.ts +4 -1
- package/dist/cli/messenger/serve-members.js +3 -1
- package/dist/cli/messenger/serve-outdated.d.ts +8 -3
- package/dist/cli/messenger/serve-outdated.js +8 -3
- package/dist/cli/messenger/serve-relay.d.ts +1 -1
- package/dist/cli/messenger/serve-relay.js +1 -1
- package/dist/cli/messenger/serve-stems.d.ts +4 -0
- package/dist/cli/messenger/serve-stems.js +3 -0
- package/dist/cli/messenger/server-command.d.ts +1 -1
- package/dist/cli/messenger/server-command.js +1 -1
- package/dist/cli/messenger/store-maintenance-command.d.ts +1 -0
- package/dist/cli/messenger/store-maintenance-command.js +9 -4
- package/dist/cli/messenger/stored.d.ts +2 -0
- package/dist/cli/messenger/stored.js +1 -0
- package/dist/cli/messenger/tasks-command.d.ts +1 -0
- package/dist/cli/messenger/tasks-command.js +1 -0
- package/dist/cli/model-catalogue-command.d.ts +1 -0
- package/dist/cli/model-catalogue-command.js +1 -0
- package/dist/cli/oauth-session.d.ts +14 -4
- package/dist/cli/oauth-session.js +9 -2
- package/dist/cli/option-hints.js +3 -4
- package/dist/cli/paging.d.ts +1 -0
- package/dist/cli/paging.js +1 -0
- package/dist/cli/path-options.d.ts +37 -0
- package/dist/cli/path-options.js +85 -0
- package/dist/cli/permission-keys.d.ts +10 -4
- package/dist/cli/permission-keys.js +9 -3
- package/dist/cli/profile.d.ts +5 -1
- package/dist/cli/profile.js +5 -1
- package/dist/cli/program.js +3 -0
- package/dist/cli/project-evidence.d.ts +9 -1
- package/dist/cli/project-evidence.js +8 -1
- package/dist/cli/project-status-rows.d.ts +2 -1
- package/dist/cli/project-status-rows.js +2 -1
- package/dist/cli/project-status.d.ts +12 -4
- package/dist/cli/project-status.js +10 -4
- package/dist/cli/provider-refs.d.ts +1 -1
- package/dist/cli/provider-refs.js +1 -1
- package/dist/cli/relay-route.js +5 -14
- package/dist/cli/result-fields.d.ts +2 -0
- package/dist/cli/result-fields.js +2 -0
- package/dist/cli/schedule/harnesses.d.ts +10 -5
- package/dist/cli/schedule/harnesses.js +9 -5
- package/dist/cli/schedule/schedule-command.d.ts +16 -6
- package/dist/cli/schedule/schedule-command.js +11 -4
- package/dist/cli/search-left-out.d.ts +5 -1
- package/dist/cli/search-left-out.js +3 -1
- package/dist/cli/service-api-call.d.ts +1 -1
- package/dist/cli/service-api-manifest.d.ts +9 -2
- package/dist/cli/service-api-manifest.js +5 -1
- package/dist/cli/service-api.d.ts +5 -2
- package/dist/cli/service-api.js +4 -1
- package/dist/cli/settings.d.ts +9 -3
- package/dist/cli/settings.js +7 -2
- package/dist/cli/setup-answers.d.ts +3 -0
- package/dist/cli/setup-answers.js +1 -0
- package/dist/cli/shadowed-options.d.ts +1 -1
- package/dist/cli/shadowed-options.js +1 -1
- package/dist/cli/shared-command-exports.d.ts +22 -0
- package/dist/cli/shared-command-exports.js +22 -0
- package/dist/cli/steps.d.ts +5 -1
- package/dist/cli/steps.js +5 -1
- package/dist/cli/store-info.d.ts +2 -0
- package/dist/cli/store-info.js +1 -0
- package/dist/cli/store-recover.d.ts +9 -3
- package/dist/cli/store-recover.js +7 -3
- package/dist/cli/store-settings.d.ts +7 -2
- package/dist/cli/store-settings.js +7 -2
- package/dist/cli/templates-command.d.ts +1 -0
- package/dist/cli/unknown-profile.d.ts +1 -1
- package/dist/cli/unknown-profile.js +1 -1
- package/dist/content/cli/index.js +3 -1
- package/dist/content/sync.d.ts +2 -0
- package/dist/content/sync.js +8 -3
- package/dist/content/testing/sync-contract.js +6 -2
- package/dist/content/writer.d.ts +1 -1
- package/dist/content/writer.js +1 -1
- package/dist/context/evidence.d.ts +4 -0
- package/dist/crm/cli/files.d.ts +1 -1
- package/dist/crm/cli/files.js +3 -2
- package/dist/crm/cli/index.d.ts +1 -1
- package/dist/crm/cli/index.js +5 -4
- package/dist/crm/cli/records.d.ts +1 -1
- package/dist/crm/cli/records.js +1 -1
- package/dist/crm/digest.d.ts +1 -1
- package/dist/crm/foreign-contacts.d.ts +2 -2
- package/dist/crm/foreign-contacts.js +2 -2
- package/dist/crm/index.d.ts +1 -1
- package/dist/crm/index.js +1 -1
- package/dist/crm/manifest/paths.d.ts +1 -1
- package/dist/crm/manifest/writer.d.ts +23 -4
- package/dist/crm/manifest/writer.js +46 -8
- package/dist/crm/source.d.ts +2 -2
- package/dist/crm/sync.d.ts +6 -2
- package/dist/crm/sync.js +16 -6
- package/dist/crm/testing/manifest-fake.d.ts +2 -1
- package/dist/crm/testing/manifest-fake.js +1 -1
- package/dist/crm/testing/sync-contract.js +7 -2
- package/dist/crm/viewer.d.ts +2 -2
- package/dist/crm/viewer.js +2 -2
- package/dist/crm/writer.d.ts +3 -2
- package/dist/crm/writer.js +9 -3
- package/dist/crm/writes.d.ts +4 -2
- package/dist/crm/writes.js +8 -5
- package/dist/domain/addresses.d.ts +7 -3
- package/dist/domain/addresses.js +7 -3
- package/dist/domain/business.d.ts +21 -4
- package/dist/domain/business.js +11 -4
- package/dist/domain/categories.d.ts +1 -1
- package/dist/domain/categories.js +1 -1
- package/dist/domain/config-repair.d.ts +1 -1
- package/dist/domain/config-repair.js +1 -1
- package/dist/domain/counters.d.ts +4 -0
- package/dist/domain/counters.js +2 -0
- package/dist/domain/crm.d.ts +18 -7
- package/dist/domain/crm.js +11 -4
- package/dist/domain/deals.d.ts +6 -3
- package/dist/domain/deals.js +4 -3
- package/dist/domain/display-names.d.ts +3 -1
- package/dist/domain/display-names.js +2 -0
- package/dist/domain/finance.d.ts +8 -2
- package/dist/domain/finance.js +4 -2
- package/dist/domain/formatting.d.ts +1 -0
- package/dist/domain/knowledge.d.ts +6 -1
- package/dist/domain/knowledge.js +6 -1
- package/dist/domain/links.d.ts +14 -2
- package/dist/domain/links.js +11 -2
- package/dist/domain/locator.d.ts +4 -1
- package/dist/domain/locator.js +3 -1
- package/dist/domain/markdown.d.ts +1 -0
- package/dist/domain/markdown.js +1 -0
- package/dist/domain/models.d.ts +38 -15
- package/dist/domain/models.js +6 -3
- package/dist/domain/money.d.ts +14 -4
- package/dist/domain/money.js +10 -3
- package/dist/domain/orders.d.ts +4 -1
- package/dist/domain/orders.js +2 -1
- package/dist/domain/person-kinds.d.ts +4 -2
- package/dist/domain/person-kinds.js +1 -0
- package/dist/domain/phones.d.ts +2 -0
- package/dist/domain/phones.js +1 -0
- package/dist/domain/polls.d.ts +1 -0
- package/dist/domain/polls.js +1 -0
- package/dist/domain/providers.d.ts +22 -7
- package/dist/domain/providers.js +22 -7
- package/dist/domain/rankings-graph.d.ts +2 -0
- package/dist/domain/rankings-options.d.ts +5 -0
- package/dist/domain/rankings-options.js +1 -0
- package/dist/domain/record-types.d.ts +5 -1
- package/dist/domain/record-types.js +1 -0
- package/dist/domain/records-table.d.ts +18 -3
- package/dist/domain/records-table.js +11 -2
- package/dist/domain/records.d.ts +18 -2
- package/dist/domain/records.js +8 -1
- package/dist/domain/ref-summaries.d.ts +22 -5
- package/dist/domain/ref-summaries.js +9 -2
- package/dist/domain/references.d.ts +4 -2
- package/dist/domain/references.js +3 -2
- package/dist/domain/relation-role-labels.d.ts +5 -1
- package/dist/domain/relation-role-labels.js +4 -1
- package/dist/domain/relations.d.ts +32 -8
- package/dist/domain/relations.js +28 -8
- package/dist/domain/send-time.d.ts +1 -2
- package/dist/domain/send-time.js +1 -2
- package/dist/domain/tag-consolidation.d.ts +5 -0
- package/dist/domain/tag-redirects.d.ts +4 -1
- package/dist/domain/tag-redirects.js +1 -1
- package/dist/domain/tags.d.ts +2 -0
- package/dist/domain/tags.js +1 -0
- package/dist/domain/vcard.d.ts +4 -1
- package/dist/domain/vcard.js +2 -1
- package/dist/entities/business-context.d.ts +10 -4
- package/dist/entities/business-context.js +10 -4
- package/dist/entities/knowledge-lists.d.ts +3 -0
- package/dist/entities/knowledge-lists.js +3 -0
- package/dist/entities/list-results.d.ts +1 -0
- package/dist/entities/list-results.js +1 -0
- package/dist/entities/listings.d.ts +12 -5
- package/dist/entities/listings.js +12 -5
- package/dist/entities/note.d.ts +1 -0
- package/dist/entities/note.js +1 -0
- package/dist/entities/store-records.d.ts +1 -0
- package/dist/entities/store-records.js +1 -0
- package/dist/errors/failures.d.ts +3 -1
- package/dist/errors/failures.js +3 -1
- package/dist/errors/reasons.d.ts +1 -0
- package/dist/errors/reasons.js +5 -38
- package/dist/errors/store-reasons.d.ts +5 -0
- package/dist/errors/store-reasons.js +62 -0
- package/dist/http/link-fetch.d.ts +1 -0
- package/dist/http/link-fetch.js +1 -0
- package/dist/http/public-url.d.ts +6 -2
- package/dist/http/public-url.js +6 -2
- package/dist/kit/contract.d.ts +1 -1
- package/dist/kit/contract.js +1 -1
- package/dist/kit/fake.d.ts +2 -1
- package/dist/kit/fake.js +1 -0
- package/dist/kit/run-scope.js +2 -1
- package/dist/kit/search-recipes.d.ts +2 -0
- package/dist/kit/search-recipes.js +1 -0
- package/dist/kit/seed.d.ts +3 -2
- package/dist/kit/seed.js +3 -2
- package/dist/mail/findings.d.ts +1 -1
- package/dist/mail/findings.js +1 -1
- package/dist/mail/headers.d.ts +9 -5
- package/dist/mail/headers.js +63 -5
- package/dist/mail/sync.js +18 -9
- package/dist/mcp/agent.d.ts +4 -1
- package/dist/mcp/agent.js +2 -1
- package/dist/mcp/all-profiles.d.ts +12 -4
- package/dist/mcp/all-profiles.js +10 -3
- package/dist/mcp/bot/instructions.d.ts +4 -1
- package/dist/mcp/bot/instructions.js +4 -1
- package/dist/mcp/caller.d.ts +1 -0
- package/dist/mcp/caller.js +1 -0
- package/dist/mcp/http/oauth.d.ts +2 -1
- package/dist/mcp/http/oauth.js +2 -1
- package/dist/mcp/http/serve.d.ts +4 -1
- package/dist/mcp/http/serve.js +3 -1
- package/dist/mcp/http/state.d.ts +1 -1
- package/dist/mcp/http/state.js +1 -1
- package/dist/mcp/meeting-preparation.d.ts +5 -1
- package/dist/mcp/meeting-preparation.js +5 -1
- package/dist/mcp/meeting-project-candidates.d.ts +2 -0
- package/dist/mcp/meeting-project-candidates.js +2 -0
- package/dist/mcp/meeting-series-inventory.d.ts +2 -0
- package/dist/mcp/meeting-series-inventory.js +2 -0
- package/dist/mcp/prompts.d.ts +1 -0
- package/dist/mcp/prompts.js +1 -0
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/session.d.ts +2 -2
- package/dist/mcp/session.js +2 -2
- package/dist/mcp/surface.d.ts +3 -2
- package/dist/mcp/surface.js +2 -1
- package/dist/meetings/cli/query-options.js +3 -2
- package/dist/meetings/event-store.d.ts +7 -2
- package/dist/meetings/findings-rules.d.ts +2 -0
- package/dist/meetings/findings.d.ts +5 -0
- package/dist/meetings/mcp/agent-text.d.ts +12 -4
- package/dist/meetings/mcp/agent-text.js +12 -4
- package/dist/meetings/mcp/index.d.ts +24 -24
- package/dist/meetings/payment.d.ts +15 -3
- package/dist/meetings/payment.js +14 -3
- package/dist/meetings/read-store.d.ts +8 -0
- package/dist/meetings/reference.d.ts +3 -0
- package/dist/meetings/reference.js +3 -0
- package/dist/meetings/result-items.d.ts +1 -0
- package/dist/meetings/result-items.js +1 -0
- package/dist/meetings/transcript-store.d.ts +0 -1
- package/dist/moderation/check.d.ts +3 -1
- package/dist/moderation/check.js +2 -0
- package/dist/moderation/rules.d.ts +5 -2
- package/dist/moderation/rules.js +5 -3
- package/dist/ports/app.d.ts +1 -0
- package/dist/ports/app.js +1 -0
- package/dist/ports/messenger.d.ts +55 -27
- package/dist/ports/traits.d.ts +4 -1
- package/dist/ports/wirecat-tools.d.ts +1 -1
- package/dist/ports/wirecat-tools.js +1 -1
- package/dist/readers/engine.d.ts +2 -2
- package/dist/readers/engine.js +2 -2
- package/dist/render/messages.d.ts +7 -1
- package/dist/render/messages.js +6 -1
- package/dist/replies/dry-run.d.ts +1 -0
- package/dist/replies/dry-run.js +1 -0
- package/dist/replies/rendering.d.ts +2 -0
- package/dist/replies/rendering.js +1 -0
- package/dist/replies/rules.d.ts +1 -2
- package/dist/replies/rules.js +1 -2
- package/dist/replies/serve.d.ts +8 -2
- package/dist/replies/serve.js +6 -1
- package/dist/replies/state.d.ts +1 -0
- package/dist/replies/state.js +1 -0
- package/dist/resolve.d.ts +5 -1
- package/dist/resolve.js +5 -1
- package/dist/runs/events.d.ts +3 -2
- package/dist/runs/events.js +2 -1
- package/dist/runs/log-events.d.ts +4 -1
- package/dist/runs/log-events.js +4 -1
- package/dist/runs/provider-log.d.ts +9 -1
- package/dist/runs/provider-log.js +8 -1
- package/dist/runs/recording.d.ts +9 -1
- package/dist/runs/recording.js +7 -1
- package/dist/runs/run-context.d.ts +1 -0
- package/dist/runs/run-context.js +1 -0
- package/dist/runs/run.d.ts +1 -0
- package/dist/runs/run.js +1 -0
- package/dist/runs/scope.d.ts +1 -0
- package/dist/runs/scope.js +1 -0
- package/dist/search/languages.d.ts +4 -1
- package/dist/search/languages.js +4 -1
- package/dist/search/question-plan.d.ts +3 -3
- package/dist/search/question-plan.js +3 -3
- package/dist/search/service-query.d.ts +7 -2
- package/dist/search/service-query.js +2 -0
- package/dist/sends/buttons.d.ts +7 -3
- package/dist/sends/buttons.js +6 -3
- package/dist/sends/flood.d.ts +3 -1
- package/dist/sends/flood.js +3 -1
- package/dist/sends/guard.d.ts +1 -0
- package/dist/sends/guard.js +1 -0
- package/dist/sends/guarded.d.ts +4 -1
- package/dist/sends/guarded.js +4 -1
- package/dist/sends/journal.d.ts +2 -2
- package/dist/sends/pace.d.ts +6 -1
- package/dist/sends/pace.js +5 -1
- package/dist/sends/permissions.d.ts +14 -9
- package/dist/sends/permissions.js +13 -8
- package/dist/sends/polls.d.ts +6 -3
- package/dist/sends/polls.js +6 -3
- package/dist/sends/recipients.d.ts +1 -0
- package/dist/sends/recipients.js +1 -0
- package/dist/sends/send-as.d.ts +1 -1
- package/dist/sends/send-as.js +1 -1
- package/dist/sends/upload.d.ts +6 -2
- package/dist/sends/upload.js +6 -2
- package/dist/services/business-context.d.ts +2 -2
- package/dist/services/business-context.js +1 -1
- package/dist/services/deal-context.d.ts +1 -1
- package/dist/services/documents/ports.d.ts +0 -2
- package/dist/services/embeddings.d.ts +3 -3
- package/dist/services/inbox.d.ts +6 -2
- package/dist/services/inbox.js +5 -1
- package/dist/services/index.d.ts +0 -1
- package/dist/services/index.js +0 -1
- package/dist/services/moderation.d.ts +1 -1
- package/dist/services/moment.d.ts +1 -0
- package/dist/services/moment.js +1 -0
- package/dist/services/organization-context.d.ts +1 -1
- package/dist/services/people.d.ts +2 -2
- package/dist/services/people.js +1 -1
- package/dist/services/person-business.d.ts +1 -1
- package/dist/services/questions.d.ts +1 -0
- package/dist/services/questions.js +1 -0
- package/dist/services/search-all.d.ts +1 -1
- package/dist/services/search-all.js +2 -2
- package/dist/services/task-rules.d.ts +1 -0
- package/dist/services/task-rules.js +1 -0
- package/dist/services/tasks.d.ts +2 -0
- package/dist/services/tasks.js +2 -0
- package/dist/setup/document.d.ts +20 -4
- package/dist/setup/document.js +20 -4
- package/dist/setup/plain.d.ts +1 -0
- package/dist/setup/plain.js +1 -0
- package/dist/speech/hearing.d.ts +1 -1
- package/dist/speech/hearing.js +1 -1
- package/dist/speech/models.d.ts +1 -1
- package/dist/sqlite-runtime.d.ts +2 -0
- package/dist/sqlite-runtime.js +2 -0
- package/dist/store/account-store.d.ts +3 -2
- package/dist/store/accounts.d.ts +1 -0
- package/dist/store/areas.d.ts +40 -0
- package/dist/store/areas.js +17 -0
- package/dist/store/attachments.d.ts +2 -0
- package/dist/store/conversations.d.ts +1 -0
- package/dist/store/counters.d.ts +2 -0
- package/dist/store/damage.d.ts +4 -1
- package/dist/store/damage.js +2 -1
- package/dist/store/decision-requests.d.ts +10 -3
- package/dist/store/decision-requests.js +9 -3
- package/dist/store/decisions.d.ts +5 -1
- package/dist/store/decisions.js +4 -1
- package/dist/store/document-transfer/index.d.ts +2 -0
- package/dist/store/document-transfer/index.js +2 -0
- package/dist/store/document-transfer/model.d.ts +3 -0
- package/dist/store/driver.d.ts +2 -0
- package/dist/store/driver.js +1 -0
- package/dist/store/evidence-findings.d.ts +10 -2
- package/dist/store/evidence-findings.js +2 -0
- package/dist/store/health.d.ts +4 -1
- package/dist/store/health.js +2 -1
- package/dist/store/identity-links.d.ts +13 -4
- package/dist/store/identity-links.js +4 -1
- package/dist/store/identity-splits.d.ts +2 -1
- package/dist/store/identity-splits.js +1 -0
- package/dist/store/index.d.ts +2 -1
- package/dist/store/index.js +1 -0
- package/dist/store/knowledge-query.d.ts +3 -0
- package/dist/store/knowledge-query.js +3 -0
- package/dist/store/mail-findings.d.ts +4 -1
- package/dist/store/mail-findings.js +1 -0
- package/dist/store/marks.d.ts +20 -3
- package/dist/store/marks.js +12 -1
- package/dist/store/meeting-findings.d.ts +2 -0
- package/dist/store/mentions.d.ts +2 -0
- package/dist/store/message-store.d.ts +219 -0
- package/dist/store/message-store.js +1 -0
- package/dist/store/messages.d.ts +1 -0
- package/dist/store/messages.js +1 -0
- package/dist/store/migrations.d.ts +8 -0
- package/dist/store/migrations.js +59 -6
- package/dist/store/open.d.ts +1 -1
- package/dist/store/open.js +1 -1
- package/dist/store/people.d.ts +5 -4
- package/dist/store/project-transfer/manifest.d.ts +3 -1
- package/dist/store/project-transfer/manifest.js +3 -1
- package/dist/store/project-transfer/plan.d.ts +3 -1
- package/dist/store/project-transfer/plan.js +1 -1
- package/dist/store/project-transfer/preview.d.ts +2 -0
- package/dist/store/project-transfer/preview.js +1 -0
- package/dist/store/project-transfer/schema.d.ts +1 -0
- package/dist/store/project-transfer/snapshot-model.d.ts +4 -0
- package/dist/store/project-transfer/snapshot-model.js +3 -0
- package/dist/store/project-transfer/snapshot-plan.d.ts +2 -1
- package/dist/store/project-transfer/snapshot-plan.js +1 -1
- package/dist/store/project-transfer/snapshot.d.ts +3 -1
- package/dist/store/project-transfer/snapshot.js +1 -1
- package/dist/store/project-transfer/store.d.ts +4 -1
- package/dist/store/providers.d.ts +1 -0
- package/dist/store/providers.js +1 -0
- package/dist/store/public.d.ts +40 -0
- package/dist/store/public.js +30 -0
- package/dist/store/queries.d.ts +1 -1
- package/dist/store/repair.d.ts +2 -2
- package/dist/store/repair.js +2 -2
- package/dist/store/roster.d.ts +1 -0
- package/dist/store/search-index.d.ts +1 -0
- package/dist/store/searches.d.ts +1 -0
- package/dist/store/source-review.d.ts +13 -6
- package/dist/store/source-review.js +2 -1
- package/dist/store/sqlite/calendar.js +7 -2
- package/dist/store/sqlite/completeness.d.ts +1 -1
- package/dist/store/sqlite/completeness.js +1 -1
- package/dist/store/sqlite/conversations.d.ts +1 -1
- package/dist/store/sqlite/conversations.js +1 -1
- package/dist/store/sqlite/copy-viewer.d.ts +1 -1
- package/dist/store/sqlite/crm-activities.d.ts +1 -1
- package/dist/store/sqlite/crm-activity-chunks.d.ts +3 -2
- package/dist/store/sqlite/crm-activity-chunks.js +3 -2
- package/dist/store/sqlite/crm-changes.d.ts +1 -1
- package/dist/store/sqlite/crm-files.d.ts +1 -1
- package/dist/store/sqlite/crm-settings.d.ts +1 -1
- package/dist/store/sqlite/crm-settings.js +1 -1
- package/dist/store/sqlite/crm.d.ts +2 -2
- package/dist/store/sqlite/drizzle/core.d.ts +1 -1
- package/dist/store/sqlite/drizzle/core.js +36 -0
- package/dist/store/sqlite/drizzle/core.js.map +4 -4
- package/dist/store/sqlite/email-activity.d.ts +1 -1
- package/dist/store/sqlite/email-activity.js +4 -1
- package/dist/store/sqlite/identity-link-rows.d.ts +1 -1
- package/dist/store/sqlite/identity-link-rows.js +1 -1
- package/dist/store/sqlite/manifest.js +105 -0
- package/dist/store/sqlite/meeting-documents.js +0 -6
- package/dist/store/sqlite/messages.d.ts +6 -1
- package/dist/store/sqlite/messages.js +14 -4
- package/dist/store/sqlite/migrations.generated.js +652 -0
- package/dist/store/sqlite/name-traces.d.ts +1 -1
- package/dist/store/sqlite/name-traces.js +1 -1
- package/dist/store/sqlite/organization-categories.d.ts +1 -1
- package/dist/store/sqlite/organization-categories.js +1 -1
- package/dist/store/sqlite/people-list.d.ts +5 -0
- package/dist/store/sqlite/people-list.js +28 -5
- package/dist/store/sqlite/person-links.d.ts +2 -2
- package/dist/store/sqlite/person-links.js +3 -3
- package/dist/store/sqlite/person-match-scan.d.ts +5 -5
- package/dist/store/sqlite/person-match-scan.js +17 -17
- package/dist/store/sqlite/pipeline-period.d.ts +1 -1
- package/dist/store/sqlite/pipeline-period.js +1 -1
- package/dist/store/sqlite/rebuild.d.ts +52 -0
- package/dist/store/sqlite/rebuild.js +176 -0
- package/dist/store/sqlite/record-projectors-phone.js +2 -1
- package/dist/store/sqlite/relation-list.d.ts +1 -1
- package/dist/store/sqlite/rollback-copy.d.ts +7 -3
- package/dist/store/sqlite/rollback-copy.js +43 -6
- package/dist/store/sqlite/schema/canonical-tags.js +1 -1
- package/dist/store/sqlite/schema/decision-requests.js +1 -1
- package/dist/store/sqlite/schema/document-changes.js +1 -1
- package/dist/store/sqlite/schema/link-revisions.js +6 -3
- package/dist/store/sqlite/schema/links.js +3 -2
- package/dist/store/sqlite/schema/tag-consolidations.js +5 -2
- package/dist/store/sqlite/schema/templates.js +1 -1
- package/dist/store/sqlite/schema.js +243 -108
- package/dist/store/sqlite/sender-signals.d.ts +42 -0
- package/dist/store/sqlite/sender-signals.js +106 -0
- package/dist/store/sqlite/vectors.d.ts +1 -1
- package/dist/store/sqlite/vectors.js +1 -1
- package/dist/store/sqlite/version-73.d.ts +12 -0
- package/dist/store/sqlite/version-73.js +114 -0
- package/dist/store/sqlite-warning.d.ts +1 -1
- package/dist/store/sqlite-warning.js +1 -1
- package/dist/store/store.d.ts +2 -176
- package/dist/store/store.js +1 -1
- package/dist/store/sync.d.ts +1 -0
- package/dist/store/types.d.ts +5 -3
- package/dist/store/vectors.d.ts +2 -0
- package/dist/tasks/model.d.ts +7 -1
- package/dist/tasks/model.js +6 -1
- package/dist/tasks/priority.d.ts +11 -2
- package/dist/tasks/priority.js +10 -2
- package/dist/terminal/qr.d.ts +1 -0
- package/dist/terminal/qr.js +1 -0
- package/dist/tracker/cli/index.js +3 -1
- package/dist/tracker/manifest/manifest.d.ts +1 -1
- package/dist/tracker/manifest/manifest.js +1 -1
- package/dist/tracker/sync.d.ts +2 -0
- package/dist/tracker/sync.js +12 -5
- package/dist/tracker/testing/manifest-fake.d.ts +2 -1
- package/dist/update/index.d.ts +5 -1
- package/dist/update/index.js +4 -1
- package/package.json +29 -9
- package/parity.json +4 -1
- package/dist/services/search-all-deprecated.d.ts +0 -40
- package/dist/services/search-all-deprecated.js +0 -10
|
@@ -1441,5 +1441,657 @@ export const GENERATED = [
|
|
|
1441
1441
|
"statements": [
|
|
1442
1442
|
"-- No foreign key on the change log, so an older build that purges an account still can; this drops its rows with it.\nCREATE TRIGGER document_changes_account_bd BEFORE DELETE ON accounts BEGIN\n DELETE FROM document_changes WHERE account_id = old.id;\nEND;"
|
|
1443
1443
|
]
|
|
1444
|
+
},
|
|
1445
|
+
{
|
|
1446
|
+
"name": "20261123230507_version-73-autoincrement",
|
|
1447
|
+
"statements": [
|
|
1448
|
+
"CREATE TABLE `__new_accounts` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`provider` text NOT NULL,\n\t`external_id` text NOT NULL,\n\t`name` text,\n\t`created_at` integer NOT NULL,\n\t`settings` text,\n\t`status` text,\n\t`updated_at` integer NOT NULL,\n\t`scope` text DEFAULT 'personal' NOT NULL,\n\t`organization_id` integer,\n\tCONSTRAINT `fk_accounts_organization_id_organizations_id_fk` FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`),\n\tCONSTRAINT `accounts_provider_external_id_unique` UNIQUE(`provider`,`external_id`),\n\tCONSTRAINT \"accounts_settings_json\" CHECK(\"settings\" IS NULL OR json_valid(\"settings\"))\n);",
|
|
1449
|
+
"INSERT INTO `__new_accounts`(`id`, `provider`, `external_id`, `name`, `created_at`, `settings`, `status`, `updated_at`, `scope`, `organization_id`) SELECT `id`, `provider`, `external_id`, `name`, `created_at`, `settings`, `status`, `updated_at`, `scope`, `organization_id` FROM `accounts`;",
|
|
1450
|
+
"DROP TABLE `accounts`;",
|
|
1451
|
+
"ALTER TABLE `__new_accounts` RENAME TO `accounts`;",
|
|
1452
|
+
"CREATE TABLE `__new_agent_actions` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`actor_type` text NOT NULL,\n\t`actor_id` integer NOT NULL,\n\t`tool` text NOT NULL,\n\t`tier` text NOT NULL,\n\t`target_type` text,\n\t`target_id` integer,\n\t`status` text NOT NULL,\n\t`error` text,\n\t`started_at` integer NOT NULL,\n\t`finished_at` integer,\n\t`created_at` integer NOT NULL,\n\tCONSTRAINT \"agent_actions_target_pair\" CHECK((\"target_type\" IS NULL) = (\"target_id\" IS NULL))\n);",
|
|
1453
|
+
"INSERT INTO `__new_agent_actions`(`id`, `actor_type`, `actor_id`, `tool`, `tier`, `target_type`, `target_id`, `status`, `error`, `started_at`, `finished_at`, `created_at`) SELECT `id`, `actor_type`, `actor_id`, `tool`, `tier`, `target_type`, `target_id`, `status`, `error`, `started_at`, `finished_at`, `created_at` FROM `agent_actions`;",
|
|
1454
|
+
"DROP TABLE `agent_actions`;",
|
|
1455
|
+
"ALTER TABLE `__new_agent_actions` RENAME TO `agent_actions`;",
|
|
1456
|
+
"CREATE TABLE `__new_attachments` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`attachable_type` text NOT NULL,\n\t`attachable_id` integer NOT NULL,\n\t`position` integer NOT NULL,\n\t`kind` text NOT NULL,\n\t`mime` text,\n\t`name` text,\n\t`title` text,\n\t`url` text,\n\t`size` integer,\n\t`width` integer,\n\t`height` integer,\n\t`duration` real,\n\t`provider_ref` text,\n\t`local_path` text,\n\t`text` text,\n\t`normalized_text` text,\n\t`extraction` text,\n\t`extractor` text,\n\t`extraction_error` text,\n\t`content_sha256` text,\n\t`extracted_at` integer,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`name_folded` text,\n\t`local_path_folded` text,\n\t`contact` text,\n\tCONSTRAINT `attachments_attachable_type_attachable_id_position_unique` UNIQUE(`attachable_type`,`attachable_id`,`position`),\n\tCONSTRAINT \"attachments_provider_ref_json\" CHECK(\"provider_ref\" IS NULL OR json_valid(\"provider_ref\")),\n\tCONSTRAINT \"attachments_contact_json\" CHECK(\"contact\" IS NULL OR json_valid(\"contact\"))\n);",
|
|
1457
|
+
"INSERT INTO `__new_attachments`(`id`, `attachable_type`, `attachable_id`, `position`, `kind`, `mime`, `name`, `title`, `url`, `size`, `width`, `height`, `duration`, `provider_ref`, `local_path`, `text`, `normalized_text`, `extraction`, `extractor`, `extraction_error`, `content_sha256`, `extracted_at`, `created_at`, `updated_at`, `name_folded`, `local_path_folded`, `contact`) SELECT `id`, `attachable_type`, `attachable_id`, `position`, `kind`, `mime`, `name`, `title`, `url`, `size`, `width`, `height`, `duration`, `provider_ref`, `local_path`, `text`, `normalized_text`, `extraction`, `extractor`, `extraction_error`, `content_sha256`, `extracted_at`, `created_at`, `updated_at`, `name_folded`, `local_path_folded`, `contact` FROM `attachments`;",
|
|
1458
|
+
"DROP TABLE `attachments`;",
|
|
1459
|
+
"ALTER TABLE `__new_attachments` RENAME TO `attachments`;",
|
|
1460
|
+
"CREATE TABLE `__new_bot_updates` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`external_id` text NOT NULL,\n\t`kind` text NOT NULL,\n\t`payload` text NOT NULL,\n\t`received_at` integer NOT NULL,\n\t`handled_at` integer,\n\t`error` text,\n\t`replayed_at` integer,\n\t`created_at` integer NOT NULL,\n\tCONSTRAINT `fk_bot_updates_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `bot_updates_account_id_external_id_unique` UNIQUE(`account_id`,`external_id`),\n\tCONSTRAINT \"bot_updates_payload_json\" CHECK(\"payload\" IS NULL OR json_valid(\"payload\"))\n);",
|
|
1461
|
+
"INSERT INTO `__new_bot_updates`(`id`, `account_id`, `external_id`, `kind`, `payload`, `received_at`, `handled_at`, `error`, `replayed_at`, `created_at`) SELECT `id`, `account_id`, `external_id`, `kind`, `payload`, `received_at`, `handled_at`, `error`, `replayed_at`, `created_at` FROM `bot_updates`;",
|
|
1462
|
+
"DROP TABLE `bot_updates`;",
|
|
1463
|
+
"ALTER TABLE `__new_bot_updates` RENAME TO `bot_updates`;",
|
|
1464
|
+
"CREATE TABLE `__new_bots` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`name` text NOT NULL UNIQUE,\n\t`kind` text NOT NULL,\n\t`description` text,\n\t`owner_person_id` integer,\n\t`model` text,\n\t`token_digest` text,\n\t`last_seen_at` integer,\n\t`disabled_at` integer,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_bots_owner_person_id_persons_id_fk` FOREIGN KEY (`owner_person_id`) REFERENCES `persons`(`id`),\n\tCONSTRAINT \"bots_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1465
|
+
"INSERT INTO `__new_bots`(`id`, `name`, `kind`, `description`, `owner_person_id`, `model`, `token_digest`, `last_seen_at`, `disabled_at`, `metadata`, `created_at`, `updated_at`) SELECT `id`, `name`, `kind`, `description`, `owner_person_id`, `model`, `token_digest`, `last_seen_at`, `disabled_at`, `metadata`, `created_at`, `updated_at` FROM `bots`;",
|
|
1466
|
+
"DROP TABLE `bots`;",
|
|
1467
|
+
"ALTER TABLE `__new_bots` RENAME TO `bots`;",
|
|
1468
|
+
"CREATE TABLE `__new_calendar_entries` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`calendar_id` integer NOT NULL,\n\t`kind` text NOT NULL,\n\t`series_entry_id` integer,\n\t`event_id` integer,\n\t`event_series_id` integer,\n\t`external_id` text NOT NULL,\n\t`ical_uid` text,\n\t`original_starts_at` integer,\n\t`exception` integer NOT NULL,\n\t`status` text NOT NULL,\n\t`title` text,\n\t`description` text,\n\t`location` text,\n\t`starts_at` integer,\n\t`ends_at` integer,\n\t`all_day` integer NOT NULL,\n\t`start_date` text,\n\t`end_date` text,\n\t`timezone` text,\n\t`recurrence` text,\n\t`recurrence_ends_at` integer,\n\t`event_type` text,\n\t`transparency` text,\n\t`visibility` text,\n\t`own_response` text,\n\t`organizer_identity_id` integer,\n\t`join_url` text,\n\t`join_key` text,\n\t`conference` text,\n\t`url` text,\n\t`sequence` integer,\n\t`etag` text,\n\t`external_updated_at` integer,\n\t`metadata` text,\n\t`seen_at` integer,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\t`series_external_id` text,\n\tCONSTRAINT `fk_calendar_entries_calendar_id_calendars_id_fk` FOREIGN KEY (`calendar_id`) REFERENCES `calendars`(`id`),\n\tCONSTRAINT `fk_calendar_entries_series_entry_id_calendar_entries_id_fk` FOREIGN KEY (`series_entry_id`) REFERENCES `calendar_entries`(`id`),\n\tCONSTRAINT `fk_calendar_entries_event_id_events_id_fk` FOREIGN KEY (`event_id`) REFERENCES `events`(`id`),\n\tCONSTRAINT `fk_calendar_entries_event_series_id_event_series_id_fk` FOREIGN KEY (`event_series_id`) REFERENCES `event_series`(`id`),\n\tCONSTRAINT `fk_calendar_entries_organizer_identity_id_identities_id_fk` FOREIGN KEY (`organizer_identity_id`) REFERENCES `identities`(`id`),\n\tCONSTRAINT `calendar_entries_calendar_id_external_id_unique` UNIQUE(`calendar_id`,`external_id`),\n\tCONSTRAINT `calendar_entries_series_entry_id_original_starts_at_unique` UNIQUE(`series_entry_id`,`original_starts_at`),\n\tCONSTRAINT \"calendar_entries_recurrence_json\" CHECK(\"recurrence\" IS NULL OR json_valid(\"recurrence\")),\n\tCONSTRAINT \"calendar_entries_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1469
|
+
"INSERT INTO `__new_calendar_entries`(`id`, `calendar_id`, `kind`, `series_entry_id`, `event_id`, `event_series_id`, `external_id`, `ical_uid`, `original_starts_at`, `exception`, `status`, `title`, `description`, `location`, `starts_at`, `ends_at`, `all_day`, `start_date`, `end_date`, `timezone`, `recurrence`, `recurrence_ends_at`, `event_type`, `transparency`, `visibility`, `own_response`, `organizer_identity_id`, `join_url`, `join_key`, `conference`, `url`, `sequence`, `etag`, `external_updated_at`, `metadata`, `seen_at`, `created_at`, `updated_at`, `deleted_at`, `series_external_id`) SELECT `id`, `calendar_id`, `kind`, `series_entry_id`, `event_id`, `event_series_id`, `external_id`, `ical_uid`, `original_starts_at`, `exception`, `status`, `title`, `description`, `location`, `starts_at`, `ends_at`, `all_day`, `start_date`, `end_date`, `timezone`, `recurrence`, `recurrence_ends_at`, `event_type`, `transparency`, `visibility`, `own_response`, `organizer_identity_id`, `join_url`, `join_key`, `conference`, `url`, `sequence`, `etag`, `external_updated_at`, `metadata`, `seen_at`, `created_at`, `updated_at`, `deleted_at`, `series_external_id` FROM `calendar_entries`;",
|
|
1470
|
+
"DROP TABLE `calendar_entries`;",
|
|
1471
|
+
"ALTER TABLE `__new_calendar_entries` RENAME TO `calendar_entries`;",
|
|
1472
|
+
"CREATE TABLE `__new_catalog_items` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`kind` text NOT NULL,\n\t`name` text NOT NULL,\n\t`name_folded` text NOT NULL,\n\t`sku` text,\n\t`supplier_type` text,\n\t`supplier_id` integer,\n\t`unit` text,\n\t`unit_price` integer,\n\t`currency` text,\n\t`description` text,\n\t`archived_date` text,\n\t`author_type` text NOT NULL,\n\t`author_id` integer NOT NULL,\n\t`model` text,\n\t`source` text NOT NULL,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT \"catalog_items_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\")),\n\tCONSTRAINT \"catalog_items_supplier_pair\" CHECK((\"supplier_type\" IS NULL) = (\"supplier_id\" IS NULL)),\n\tCONSTRAINT \"catalog_items_unit_price_not_negative\" CHECK(\"unit_price\" IS NULL OR \"unit_price\" >= 0)\n);",
|
|
1473
|
+
"INSERT INTO `__new_catalog_items`(`id`, `kind`, `name`, `name_folded`, `sku`, `supplier_type`, `supplier_id`, `unit`, `unit_price`, `currency`, `description`, `archived_date`, `author_type`, `author_id`, `model`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `kind`, `name`, `name_folded`, `sku`, `supplier_type`, `supplier_id`, `unit`, `unit_price`, `currency`, `description`, `archived_date`, `author_type`, `author_id`, `model`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at` FROM `catalog_items`;",
|
|
1474
|
+
"DROP TABLE `catalog_items`;",
|
|
1475
|
+
"ALTER TABLE `__new_catalog_items` RENAME TO `catalog_items`;",
|
|
1476
|
+
"CREATE TABLE `__new_chats` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`external_id` text NOT NULL,\n\t`kind` text NOT NULL,\n\t`title` text,\n\t`unread_count` integer,\n\t`last_message_at` integer,\n\t`participants_count` integer,\n\t`metadata` text,\n\t`updated_at` integer NOT NULL,\n\t`username` text,\n\t`membership_state` text,\n\t`searchable` integer DEFAULT 1 NOT NULL,\n\t`message_count` integer DEFAULT 0 NOT NULL,\n\t`members_tracked_at` integer,\n\t`description` text,\n\t`details_fetched_at` integer,\n\t`created_at` integer NOT NULL,\n\t`parent_chat_id` integer,\n\t`scope` text,\n\t`muted` integer,\n\t`muted_until` integer,\n\t`archived` integer,\n\t`marked_unread` integer,\n\t`unread_counted_at` integer,\n\t`title_folded` text,\n\tCONSTRAINT `fk_chats_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `fk_chats_parent_chat_id_chats_id_fk` FOREIGN KEY (`parent_chat_id`) REFERENCES `chats`(`id`),\n\tCONSTRAINT `chats_account_id_external_id_unique` UNIQUE(`account_id`,`external_id`),\n\tCONSTRAINT \"chats_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1477
|
+
"INSERT INTO `__new_chats`(`id`, `account_id`, `external_id`, `kind`, `title`, `unread_count`, `last_message_at`, `participants_count`, `metadata`, `updated_at`, `username`, `membership_state`, `searchable`, `message_count`, `members_tracked_at`, `description`, `details_fetched_at`, `created_at`, `parent_chat_id`, `scope`, `muted`, `muted_until`, `archived`, `marked_unread`, `unread_counted_at`, `title_folded`) SELECT `id`, `account_id`, `external_id`, `kind`, `title`, `unread_count`, `last_message_at`, `participants_count`, `metadata`, `updated_at`, `username`, `membership_state`, `searchable`, `message_count`, `members_tracked_at`, `description`, `details_fetched_at`, `created_at`, `parent_chat_id`, `scope`, `muted`, `muted_until`, `archived`, `marked_unread`, `unread_counted_at`, `title_folded` FROM `chats`;",
|
|
1478
|
+
"DROP TABLE `chats`;",
|
|
1479
|
+
"ALTER TABLE `__new_chats` RENAME TO `chats`;",
|
|
1480
|
+
"CREATE TABLE `__new_content_authors` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`external_id` text NOT NULL,\n\t`name` text NOT NULL,\n\t`email` text,\n\t`data` text NOT NULL,\n\t`source_updated_at` integer,\n\t`deleted_at` integer,\n\t`synced_at` integer NOT NULL,\n\tCONSTRAINT `fk_content_authors_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `content_authors_account_id_external_id_unique` UNIQUE(`account_id`,`external_id`),\n\tCONSTRAINT \"content_authors_data_json\" CHECK(\"data\" IS NULL OR json_valid(\"data\"))\n);",
|
|
1481
|
+
"INSERT INTO `__new_content_authors`(`id`, `account_id`, `external_id`, `name`, `email`, `data`, `source_updated_at`, `deleted_at`, `synced_at`) SELECT `id`, `account_id`, `external_id`, `name`, `email`, `data`, `source_updated_at`, `deleted_at`, `synced_at` FROM `content_authors`;",
|
|
1482
|
+
"DROP TABLE `content_authors`;",
|
|
1483
|
+
"ALTER TABLE `__new_content_authors` RENAME TO `content_authors`;",
|
|
1484
|
+
"CREATE TABLE `__new_content_metrics` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`post_id` integer NOT NULL,\n\t`at` integer NOT NULL,\n\t`views` integer,\n\t`reactions` integer,\n\t`comments` integer,\n\t`shares` integer,\n\t`clicks` integer,\n\t`raw` text,\n\tCONSTRAINT `fk_content_metrics_post_id_content_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `content_posts`(`id`),\n\tCONSTRAINT \"content_metrics_raw_json\" CHECK(\"raw\" IS NULL OR json_valid(\"raw\"))\n);",
|
|
1485
|
+
"INSERT INTO `__new_content_metrics`(`id`, `post_id`, `at`, `views`, `reactions`, `comments`, `shares`, `clicks`, `raw`) SELECT `id`, `post_id`, `at`, `views`, `reactions`, `comments`, `shares`, `clicks`, `raw` FROM `content_metrics`;",
|
|
1486
|
+
"DROP TABLE `content_metrics`;",
|
|
1487
|
+
"ALTER TABLE `__new_content_metrics` RENAME TO `content_metrics`;",
|
|
1488
|
+
"CREATE TABLE `__new_content_posts` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`external_id` text NOT NULL,\n\t`channel_id` text,\n\t`type` text NOT NULL,\n\t`title` text,\n\t`title_folded` text NOT NULL,\n\t`body` text,\n\t`content_hash` text NOT NULL,\n\t`status` text NOT NULL,\n\t`published_at` integer,\n\t`scheduled_for` integer,\n\t`source_created_at` integer,\n\t`source_updated_at` integer,\n\t`version` text,\n\t`normalized_text` text NOT NULL,\n\t`data` text NOT NULL,\n\t`deleted_at` integer,\n\t`synced_at` integer NOT NULL,\n\tCONSTRAINT `fk_content_posts_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `content_posts_account_id_external_id_unique` UNIQUE(`account_id`,`external_id`),\n\tCONSTRAINT \"content_posts_data_json\" CHECK(\"data\" IS NULL OR json_valid(\"data\"))\n);",
|
|
1489
|
+
"INSERT INTO `__new_content_posts`(`id`, `account_id`, `external_id`, `channel_id`, `type`, `title`, `title_folded`, `body`, `content_hash`, `status`, `published_at`, `scheduled_for`, `source_created_at`, `source_updated_at`, `version`, `normalized_text`, `data`, `deleted_at`, `synced_at`) SELECT `id`, `account_id`, `external_id`, `channel_id`, `type`, `title`, `title_folded`, `body`, `content_hash`, `status`, `published_at`, `scheduled_for`, `source_created_at`, `source_updated_at`, `version`, `normalized_text`, `data`, `deleted_at`, `synced_at` FROM `content_posts`;",
|
|
1490
|
+
"DROP TABLE `content_posts`;",
|
|
1491
|
+
"ALTER TABLE `__new_content_posts` RENAME TO `content_posts`;",
|
|
1492
|
+
"CREATE TABLE `__new_content_terms` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`external_id` text NOT NULL,\n\t`kind` text NOT NULL,\n\t`name` text NOT NULL,\n\t`slug` text,\n\t`parent_id` text,\n\t`tag_id` integer,\n\t`data` text NOT NULL,\n\t`source_updated_at` integer,\n\t`deleted_at` integer,\n\t`synced_at` integer NOT NULL,\n\tCONSTRAINT `fk_content_terms_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `fk_content_terms_tag_id_canonical_tags_id_fk` FOREIGN KEY (`tag_id`) REFERENCES `canonical_tags`(`id`),\n\tCONSTRAINT `content_terms_account_id_external_id_unique` UNIQUE(`account_id`,`external_id`),\n\tCONSTRAINT \"content_terms_data_json\" CHECK(\"data\" IS NULL OR json_valid(\"data\"))\n);",
|
|
1493
|
+
"INSERT INTO `__new_content_terms`(`id`, `account_id`, `external_id`, `kind`, `name`, `slug`, `parent_id`, `tag_id`, `data`, `source_updated_at`, `deleted_at`, `synced_at`) SELECT `id`, `account_id`, `external_id`, `kind`, `name`, `slug`, `parent_id`, `tag_id`, `data`, `source_updated_at`, `deleted_at`, `synced_at` FROM `content_terms`;",
|
|
1494
|
+
"DROP TABLE `content_terms`;",
|
|
1495
|
+
"ALTER TABLE `__new_content_terms` RENAME TO `content_terms`;",
|
|
1496
|
+
"CREATE TABLE `__new_contracts` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`name` text NOT NULL,\n\t`number` text,\n\t`kind` text NOT NULL,\n\t`status` text NOT NULL,\n\t`signed_date` text,\n\t`effective_date` text,\n\t`expiration_date` text,\n\t`auto_renew` integer DEFAULT 0 NOT NULL,\n\t`renewal_count` integer,\n\t`renewal_unit` text,\n\t`notice_days` integer,\n\t`terms` text,\n\t`value` integer,\n\t`currency` text,\n\t`project_id` integer,\n\t`deal_id` integer,\n\t`review` text NOT NULL,\n\t`author_type` text NOT NULL,\n\t`author_id` integer NOT NULL,\n\t`model` text,\n\t`confirmed_by_type` text,\n\t`confirmed_by_id` integer,\n\t`source` text NOT NULL,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT `fk_contracts_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n\tCONSTRAINT `fk_contracts_deal_id_deals_id_fk` FOREIGN KEY (`deal_id`) REFERENCES `deals`(`id`),\n\tCONSTRAINT \"contracts_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\")),\n\tCONSTRAINT \"contracts_confirmed_by_pair\" CHECK((\"confirmed_by_type\" IS NULL) = (\"confirmed_by_id\" IS NULL)),\n\tCONSTRAINT \"contracts_value_not_negative\" CHECK(\"value\" IS NULL OR \"value\" >= 0)\n);",
|
|
1497
|
+
"INSERT INTO `__new_contracts`(`id`, `name`, `number`, `kind`, `status`, `signed_date`, `effective_date`, `expiration_date`, `auto_renew`, `renewal_count`, `renewal_unit`, `notice_days`, `terms`, `value`, `currency`, `project_id`, `deal_id`, `review`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `name`, `number`, `kind`, `status`, `signed_date`, `effective_date`, `expiration_date`, `auto_renew`, `renewal_count`, `renewal_unit`, `notice_days`, `terms`, `value`, `currency`, `project_id`, `deal_id`, `review`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at` FROM `contracts`;",
|
|
1498
|
+
"DROP TABLE `contracts`;",
|
|
1499
|
+
"ALTER TABLE `__new_contracts` RENAME TO `contracts`;",
|
|
1500
|
+
"CREATE TABLE `__new_crm_fields` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`kind` text NOT NULL,\n\t`code` text NOT NULL,\n\t`label` text,\n\t`type` text NOT NULL,\n\t`multiple` integer NOT NULL,\n\t`filterable` integer NOT NULL,\n\t`options` text,\n\t`position` integer NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT `fk_crm_fields_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `crm_fields_account_id_kind_code_unique` UNIQUE(`account_id`,`kind`,`code`),\n\tCONSTRAINT \"crm_fields_options_json\" CHECK(\"options\" IS NULL OR json_valid(\"options\"))\n);",
|
|
1501
|
+
"INSERT INTO `__new_crm_fields`(`id`, `account_id`, `kind`, `code`, `label`, `type`, `multiple`, `filterable`, `options`, `position`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `account_id`, `kind`, `code`, `label`, `type`, `multiple`, `filterable`, `options`, `position`, `created_at`, `updated_at`, `deleted_at` FROM `crm_fields`;",
|
|
1502
|
+
"DROP TABLE `crm_fields`;",
|
|
1503
|
+
"ALTER TABLE `__new_crm_fields` RENAME TO `crm_fields`;",
|
|
1504
|
+
"CREATE TABLE `__new_deals` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`title` text NOT NULL,\n\t`organization_id` integer,\n\t`project_id` integer,\n\t`stage_id` integer NOT NULL,\n\t`status` text NOT NULL,\n\t`currency` text,\n\t`amount` integer,\n\t`close_date` text,\n\t`closed_date` text,\n\t`rank` real,\n\t`account_id` integer,\n\t`external_id` text,\n\t`author_type` text NOT NULL,\n\t`author_id` integer NOT NULL,\n\t`model` text,\n\t`source` text NOT NULL,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT `fk_deals_organization_id_organizations_id_fk` FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`),\n\tCONSTRAINT `fk_deals_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n\tCONSTRAINT `fk_deals_stage_id_pipeline_stages_id_fk` FOREIGN KEY (`stage_id`) REFERENCES `pipeline_stages`(`id`),\n\tCONSTRAINT `fk_deals_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT \"deals_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\")),\n\tCONSTRAINT \"deals_amount_not_negative\" CHECK(\"amount\" IS NULL OR \"amount\" >= 0)\n);",
|
|
1505
|
+
"INSERT INTO `__new_deals`(`id`, `title`, `organization_id`, `project_id`, `stage_id`, `status`, `currency`, `amount`, `close_date`, `closed_date`, `rank`, `account_id`, `external_id`, `author_type`, `author_id`, `model`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `title`, `organization_id`, `project_id`, `stage_id`, `status`, `currency`, `amount`, `close_date`, `closed_date`, `rank`, `account_id`, `external_id`, `author_type`, `author_id`, `model`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at` FROM `deals`;",
|
|
1506
|
+
"DROP TABLE `deals`;",
|
|
1507
|
+
"ALTER TABLE `__new_deals` RENAME TO `deals`;",
|
|
1508
|
+
"CREATE TABLE `__new_decisions` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`project_id` integer,\n\t`statement` text NOT NULL,\n\t`status` text NOT NULL,\n\t`decided_at` integer,\n\t`supersedes_id` integer,\n\t`confirmed_by_type` text,\n\t`confirmed_by_id` integer,\n\t`source` text NOT NULL,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT `fk_decisions_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n\tCONSTRAINT `fk_decisions_supersedes_id_decisions_id_fk` FOREIGN KEY (`supersedes_id`) REFERENCES `decisions`(`id`),\n\tCONSTRAINT \"decisions_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\")),\n\tCONSTRAINT \"decisions_confirmed_by_pair\" CHECK((\"confirmed_by_type\" IS NULL) = (\"confirmed_by_id\" IS NULL))\n);",
|
|
1509
|
+
"INSERT INTO `__new_decisions`(`id`, `project_id`, `statement`, `status`, `decided_at`, `supersedes_id`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `project_id`, `statement`, `status`, `decided_at`, `supersedes_id`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at` FROM `decisions`;",
|
|
1510
|
+
"DROP TABLE `decisions`;",
|
|
1511
|
+
"ALTER TABLE `__new_decisions` RENAME TO `decisions`;",
|
|
1512
|
+
"CREATE TABLE `__new_document_revisions` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`document_id` integer NOT NULL,\n\t`body` text NOT NULL,\n\t`revision` integer NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`title` text,\n\t`front_matter` text,\n\t`reason` text,\n\tCONSTRAINT `fk_document_revisions_document_id_documents_id_fk` FOREIGN KEY (`document_id`) REFERENCES `documents`(`id`),\n\tCONSTRAINT \"document_revisions_front_matter_json\" CHECK(\"front_matter\" IS NULL OR json_valid(\"front_matter\"))\n);",
|
|
1513
|
+
"INSERT INTO `__new_document_revisions`(`id`, `document_id`, `body`, `revision`, `created_at`, `title`, `front_matter`, `reason`) SELECT `id`, `document_id`, `body`, `revision`, `created_at`, `title`, `front_matter`, `reason` FROM `document_revisions`;",
|
|
1514
|
+
"DROP TABLE `document_revisions`;",
|
|
1515
|
+
"ALTER TABLE `__new_document_revisions` RENAME TO `document_revisions`;",
|
|
1516
|
+
"CREATE TABLE `__new_documents` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`external_id` text NOT NULL,\n\t`kind` text NOT NULL,\n\t`title` text,\n\t`location` text,\n\t`file_name` text,\n\t`extension` text,\n\t`url` text,\n\t`storage` text,\n\t`local_path` text,\n\t`mime` text,\n\t`size` integer,\n\t`content_hash` text,\n\t`front_matter` text,\n\t`body` text,\n\t`normalized_text` text,\n\t`extraction` text,\n\t`extraction_error` text,\n\t`language` text,\n\t`revision` integer DEFAULT 1 NOT NULL,\n\t`export_path` text,\n\t`external_created_at` integer,\n\t`external_updated_at` integer,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\t`pinned_file_id` integer,\n\t`removal` text,\n\tCONSTRAINT `fk_documents_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `documents_account_id_external_id_unique` UNIQUE(`account_id`,`external_id`),\n\tCONSTRAINT \"documents_front_matter_json\" CHECK(\"front_matter\" IS NULL OR json_valid(\"front_matter\")),\n\tCONSTRAINT \"documents_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1517
|
+
"INSERT INTO `__new_documents`(`id`, `account_id`, `external_id`, `kind`, `title`, `location`, `file_name`, `extension`, `url`, `storage`, `local_path`, `mime`, `size`, `content_hash`, `front_matter`, `body`, `normalized_text`, `extraction`, `extraction_error`, `language`, `revision`, `export_path`, `external_created_at`, `external_updated_at`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `pinned_file_id`, `removal`) SELECT `id`, `account_id`, `external_id`, `kind`, `title`, `location`, `file_name`, `extension`, `url`, `storage`, `local_path`, `mime`, `size`, `content_hash`, `front_matter`, `body`, `normalized_text`, `extraction`, `extraction_error`, `language`, `revision`, `export_path`, `external_created_at`, `external_updated_at`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `pinned_file_id`, `removal` FROM `documents`;",
|
|
1518
|
+
"DROP TABLE `documents`;",
|
|
1519
|
+
"ALTER TABLE `__new_documents` RENAME TO `documents`;",
|
|
1520
|
+
"CREATE TABLE `__new_email_threads` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`external_id` text NOT NULL,\n\t`subject` text,\n\t`last_email_at` integer,\n\t`emails_count` integer DEFAULT 0 NOT NULL,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\t`subject_folded` text,\n\tCONSTRAINT `fk_email_threads_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `email_threads_account_id_external_id_unique` UNIQUE(`account_id`,`external_id`),\n\tCONSTRAINT \"email_threads_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1521
|
+
"INSERT INTO `__new_email_threads`(`id`, `account_id`, `external_id`, `subject`, `last_email_at`, `emails_count`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `subject_folded`) SELECT `id`, `account_id`, `external_id`, `subject`, `last_email_at`, `emails_count`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `subject_folded` FROM `email_threads`;",
|
|
1522
|
+
"DROP TABLE `email_threads`;",
|
|
1523
|
+
"ALTER TABLE `__new_email_threads` RENAME TO `email_threads`;",
|
|
1524
|
+
"CREATE TABLE `__new_emails` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`email_thread_id` integer NOT NULL,\n\t`external_id` text NOT NULL,\n\t`subject` text,\n\t`from_identity_id` integer,\n\t`from_address` text,\n\t`from_name` text,\n\t`sent_at` integer,\n\t`received_at` integer,\n\t`in_reply_to` text,\n\t`references` text,\n\t`body_text` text,\n\t`body_html` text,\n\t`snippet` text,\n\t`outgoing` integer,\n\t`read` integer,\n\t`flagged` integer,\n\t`draft` integer,\n\t`size` integer,\n\t`headers` text,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\t`mail_rule_id` integer,\n\tCONSTRAINT `fk_emails_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `fk_emails_email_thread_id_email_threads_id_fk` FOREIGN KEY (`email_thread_id`) REFERENCES `email_threads`(`id`),\n\tCONSTRAINT `fk_emails_from_identity_id_identities_id_fk` FOREIGN KEY (`from_identity_id`) REFERENCES `identities`(`id`),\n\tCONSTRAINT `emails_account_id_external_id_unique` UNIQUE(`account_id`,`external_id`),\n\tCONSTRAINT \"emails_references_json\" CHECK(\"references\" IS NULL OR json_valid(\"references\")),\n\tCONSTRAINT \"emails_headers_json\" CHECK(\"headers\" IS NULL OR json_valid(\"headers\")),\n\tCONSTRAINT \"emails_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1525
|
+
"INSERT INTO `__new_emails`(`id`, `account_id`, `email_thread_id`, `external_id`, `subject`, `from_identity_id`, `from_address`, `from_name`, `sent_at`, `received_at`, `in_reply_to`, `references`, `body_text`, `body_html`, `snippet`, `outgoing`, `read`, `flagged`, `draft`, `size`, `headers`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `mail_rule_id`) SELECT `id`, `account_id`, `email_thread_id`, `external_id`, `subject`, `from_identity_id`, `from_address`, `from_name`, `sent_at`, `received_at`, `in_reply_to`, `references`, `body_text`, `body_html`, `snippet`, `outgoing`, `read`, `flagged`, `draft`, `size`, `headers`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `mail_rule_id` FROM `emails`;",
|
|
1526
|
+
"DROP TABLE `emails`;",
|
|
1527
|
+
"ALTER TABLE `__new_emails` RENAME TO `emails`;",
|
|
1528
|
+
"CREATE TABLE `__new_facts` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`type` text NOT NULL,\n\t`statement` text NOT NULL,\n\t`status` text NOT NULL,\n\t`project_id` integer,\n\t`subject_type` text,\n\t`subject_id` integer,\n\t`occurred_at` integer,\n\t`supersedes_id` integer,\n\t`author_type` text NOT NULL,\n\t`author_id` integer NOT NULL,\n\t`model` text,\n\t`confirmed_by_type` text,\n\t`confirmed_by_id` integer,\n\t`scope` text,\n\t`source` text NOT NULL,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT `fk_facts_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n\tCONSTRAINT `fk_facts_supersedes_id_facts_id_fk` FOREIGN KEY (`supersedes_id`) REFERENCES `facts`(`id`),\n\tCONSTRAINT \"facts_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\")),\n\tCONSTRAINT \"facts_subject_pair\" CHECK((\"subject_type\" IS NULL) = (\"subject_id\" IS NULL)),\n\tCONSTRAINT \"facts_confirmed_by_pair\" CHECK((\"confirmed_by_type\" IS NULL) = (\"confirmed_by_id\" IS NULL))\n);",
|
|
1529
|
+
"INSERT INTO `__new_facts`(`id`, `type`, `statement`, `status`, `project_id`, `subject_type`, `subject_id`, `occurred_at`, `supersedes_id`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `scope`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `type`, `statement`, `status`, `project_id`, `subject_type`, `subject_id`, `occurred_at`, `supersedes_id`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `scope`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at` FROM `facts`;",
|
|
1530
|
+
"DROP TABLE `facts`;",
|
|
1531
|
+
"ALTER TABLE `__new_facts` RENAME TO `facts`;",
|
|
1532
|
+
"CREATE TABLE `__new_files` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`external_id` text NOT NULL,\n\t`kind` text NOT NULL,\n\t`name` text NOT NULL,\n\t`path` text NOT NULL,\n\t`path_folded` text,\n\t`parent_id` integer,\n\t`document_id` integer,\n\t`mime` text,\n\t`size` integer,\n\t`content_hash` text,\n\t`url` text,\n\t`external_created_at` integer,\n\t`external_updated_at` integer,\n\t`metadata` text,\n\t`seen_at` integer,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT `fk_files_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `fk_files_parent_id_files_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `files`(`id`),\n\tCONSTRAINT `fk_files_document_id_documents_id_fk` FOREIGN KEY (`document_id`) REFERENCES `documents`(`id`),\n\tCONSTRAINT `files_account_id_external_id_unique` UNIQUE(`account_id`,`external_id`),\n\tCONSTRAINT \"files_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1533
|
+
"INSERT INTO `__new_files`(`id`, `account_id`, `external_id`, `kind`, `name`, `path`, `path_folded`, `parent_id`, `document_id`, `mime`, `size`, `content_hash`, `url`, `external_created_at`, `external_updated_at`, `metadata`, `seen_at`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `account_id`, `external_id`, `kind`, `name`, `path`, `path_folded`, `parent_id`, `document_id`, `mime`, `size`, `content_hash`, `url`, `external_created_at`, `external_updated_at`, `metadata`, `seen_at`, `created_at`, `updated_at`, `deleted_at` FROM `files`;",
|
|
1534
|
+
"DROP TABLE `files`;",
|
|
1535
|
+
"ALTER TABLE `__new_files` RENAME TO `files`;",
|
|
1536
|
+
"CREATE TABLE `__new_financial_accounts` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`name` text NOT NULL,\n\t`name_folded` text NOT NULL,\n\t`kind` text NOT NULL,\n\t`currency` text NOT NULL,\n\t`institution` text,\n\t`number_hint` text,\n\t`holder_type` text,\n\t`holder_id` integer,\n\t`opening_balance` integer,\n\t`opening_date` text,\n\t`closed_date` text,\n\t`author_type` text NOT NULL,\n\t`author_id` integer NOT NULL,\n\t`model` text,\n\t`source` text NOT NULL,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT \"financial_accounts_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\")),\n\tCONSTRAINT \"financial_accounts_holder_pair\" CHECK((\"holder_type\" IS NULL) = (\"holder_id\" IS NULL))\n);",
|
|
1537
|
+
"INSERT INTO `__new_financial_accounts`(`id`, `name`, `name_folded`, `kind`, `currency`, `institution`, `number_hint`, `holder_type`, `holder_id`, `opening_balance`, `opening_date`, `closed_date`, `author_type`, `author_id`, `model`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `name`, `name_folded`, `kind`, `currency`, `institution`, `number_hint`, `holder_type`, `holder_id`, `opening_balance`, `opening_date`, `closed_date`, `author_type`, `author_id`, `model`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at` FROM `financial_accounts`;",
|
|
1538
|
+
"DROP TABLE `financial_accounts`;",
|
|
1539
|
+
"ALTER TABLE `__new_financial_accounts` RENAME TO `financial_accounts`;",
|
|
1540
|
+
"CREATE TABLE `__new_financial_transactions` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`financial_account_id` integer NOT NULL,\n\t`direction` text NOT NULL,\n\t`amount` integer NOT NULL,\n\t`currency` text NOT NULL,\n\t`status` text NOT NULL,\n\t`statement_date` text NOT NULL,\n\t`booked_date` text,\n\t`description` text,\n\t`counterparty_name` text,\n\t`counterparty_type` text,\n\t`counterparty_id` integer,\n\t`reference` text,\n\t`payment_id` integer,\n\t`project_id` integer,\n\t`review` text NOT NULL,\n\t`author_type` text NOT NULL,\n\t`author_id` integer NOT NULL,\n\t`model` text,\n\t`confirmed_by_type` text,\n\t`confirmed_by_id` integer,\n\t`source` text NOT NULL,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT `fk_financial_transactions_financial_account_id_financial_accounts_id_fk` FOREIGN KEY (`financial_account_id`) REFERENCES `financial_accounts`(`id`),\n\tCONSTRAINT `fk_financial_transactions_payment_id_payments_id_fk` FOREIGN KEY (`payment_id`) REFERENCES `payments`(`id`),\n\tCONSTRAINT `fk_financial_transactions_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n\tCONSTRAINT \"financial_transactions_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\")),\n\tCONSTRAINT \"financial_transactions_counterparty_pair\" CHECK((\"counterparty_type\" IS NULL) = (\"counterparty_id\" IS NULL)),\n\tCONSTRAINT \"financial_transactions_confirmed_by_pair\" CHECK((\"confirmed_by_type\" IS NULL) = (\"confirmed_by_id\" IS NULL))\n);",
|
|
1541
|
+
"INSERT INTO `__new_financial_transactions`(`id`, `financial_account_id`, `direction`, `amount`, `currency`, `status`, `statement_date`, `booked_date`, `description`, `counterparty_name`, `counterparty_type`, `counterparty_id`, `reference`, `payment_id`, `project_id`, `review`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `financial_account_id`, `direction`, `amount`, `currency`, `status`, `statement_date`, `booked_date`, `description`, `counterparty_name`, `counterparty_type`, `counterparty_id`, `reference`, `payment_id`, `project_id`, `review`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at` FROM `financial_transactions`;",
|
|
1542
|
+
"DROP TABLE `financial_transactions`;",
|
|
1543
|
+
"ALTER TABLE `__new_financial_transactions` RENAME TO `financial_transactions`;",
|
|
1544
|
+
"CREATE TABLE `__new_identities` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`provider` text NOT NULL,\n\t`external_id` text NOT NULL,\n\t`username` text,\n\t`name` text,\n\t`bot` integer,\n\t`phone_hmac` text,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`description` text,\n\t`email` text,\n\t`phone` text,\n\t`name_folded` text,\n\tCONSTRAINT `identities_provider_external_id_unique` UNIQUE(`provider`,`external_id`),\n\tCONSTRAINT \"identities_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1545
|
+
"INSERT INTO `__new_identities`(`id`, `provider`, `external_id`, `username`, `name`, `bot`, `phone_hmac`, `metadata`, `created_at`, `updated_at`, `description`, `email`, `phone`, `name_folded`) SELECT `id`, `provider`, `external_id`, `username`, `name`, `bot`, `phone_hmac`, `metadata`, `created_at`, `updated_at`, `description`, `email`, `phone`, `name_folded` FROM `identities`;",
|
|
1546
|
+
"DROP TABLE `identities`;",
|
|
1547
|
+
"ALTER TABLE `__new_identities` RENAME TO `identities`;",
|
|
1548
|
+
"CREATE TABLE `__new_identity_revisions` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`identity_id` integer NOT NULL,\n\t`name` text,\n\t`username` text,\n\t`description` text,\n\t`marks` text,\n\t`created_at` integer NOT NULL,\n\tCONSTRAINT `fk_identity_revisions_identity_id_identities_id_fk` FOREIGN KEY (`identity_id`) REFERENCES `identities`(`id`),\n\tCONSTRAINT \"identity_revisions_marks_json\" CHECK(\"marks\" IS NULL OR json_valid(\"marks\"))\n);",
|
|
1549
|
+
"INSERT INTO `__new_identity_revisions`(`id`, `identity_id`, `name`, `username`, `description`, `marks`, `created_at`) SELECT `id`, `identity_id`, `name`, `username`, `description`, `marks`, `created_at` FROM `identity_revisions`;",
|
|
1550
|
+
"DROP TABLE `identity_revisions`;",
|
|
1551
|
+
"ALTER TABLE `__new_identity_revisions` RENAME TO `identity_revisions`;",
|
|
1552
|
+
"CREATE TABLE `__new_invoice_lines` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`invoice_id` integer NOT NULL,\n\t`position` integer NOT NULL,\n\t`description` text NOT NULL,\n\t`quantity` text NOT NULL,\n\t`unit_price` integer,\n\t`amount` integer NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`catalog_item_id` integer,\n\tCONSTRAINT `fk_invoice_lines_invoice_id_invoices_id_fk` FOREIGN KEY (`invoice_id`) REFERENCES `invoices`(`id`),\n\tCONSTRAINT `fk_invoice_lines_catalog_item_id_catalog_items_id_fk` FOREIGN KEY (`catalog_item_id`) REFERENCES `catalog_items`(`id`),\n\tCONSTRAINT `invoice_lines_invoice_id_position_unique` UNIQUE(`invoice_id`,`position`),\n\tCONSTRAINT \"invoice_lines_amount_not_negative\" CHECK(\"amount\" IS NULL OR \"amount\" >= 0),\n\tCONSTRAINT \"invoice_lines_unit_price_not_negative\" CHECK(\"unit_price\" IS NULL OR \"unit_price\" >= 0)\n);",
|
|
1553
|
+
"INSERT INTO `__new_invoice_lines`(`id`, `invoice_id`, `position`, `description`, `quantity`, `unit_price`, `amount`, `created_at`, `updated_at`, `catalog_item_id`) SELECT `id`, `invoice_id`, `position`, `description`, `quantity`, `unit_price`, `amount`, `created_at`, `updated_at`, `catalog_item_id` FROM `invoice_lines`;",
|
|
1554
|
+
"DROP TABLE `invoice_lines`;",
|
|
1555
|
+
"ALTER TABLE `__new_invoice_lines` RENAME TO `invoice_lines`;",
|
|
1556
|
+
"CREATE TABLE `__new_invoices` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`direction` text NOT NULL,\n\t`number` text,\n\t`issuer_type` text,\n\t`issuer_id` integer,\n\t`counterparty_type` text NOT NULL,\n\t`counterparty_id` integer NOT NULL,\n\t`project_id` integer,\n\t`currency` text NOT NULL,\n\t`total` integer NOT NULL,\n\t`issue_date` text,\n\t`due_date` text,\n\t`status` text NOT NULL,\n\t`review` text NOT NULL,\n\t`author_type` text NOT NULL,\n\t`author_id` integer NOT NULL,\n\t`model` text,\n\t`confirmed_by_type` text,\n\t`confirmed_by_id` integer,\n\t`source` text NOT NULL,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\t`contract_id` integer,\n\t`subscription_id` integer,\n\tCONSTRAINT `fk_invoices_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n\tCONSTRAINT `fk_invoices_contract_id_contracts_id_fk` FOREIGN KEY (`contract_id`) REFERENCES `contracts`(`id`),\n\tCONSTRAINT `fk_invoices_subscription_id_subscriptions_id_fk` FOREIGN KEY (`subscription_id`) REFERENCES `subscriptions`(`id`),\n\tCONSTRAINT \"invoices_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\")),\n\tCONSTRAINT \"invoices_issuer_pair\" CHECK((\"issuer_type\" IS NULL) = (\"issuer_id\" IS NULL)),\n\tCONSTRAINT \"invoices_confirmed_by_pair\" CHECK((\"confirmed_by_type\" IS NULL) = (\"confirmed_by_id\" IS NULL)),\n\tCONSTRAINT \"invoices_total_not_negative\" CHECK(\"total\" IS NULL OR \"total\" >= 0)\n);",
|
|
1557
|
+
"INSERT INTO `__new_invoices`(`id`, `direction`, `number`, `issuer_type`, `issuer_id`, `counterparty_type`, `counterparty_id`, `project_id`, `currency`, `total`, `issue_date`, `due_date`, `status`, `review`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `contract_id`, `subscription_id`) SELECT `id`, `direction`, `number`, `issuer_type`, `issuer_id`, `counterparty_type`, `counterparty_id`, `project_id`, `currency`, `total`, `issue_date`, `due_date`, `status`, `review`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `contract_id`, `subscription_id` FROM `invoices`;",
|
|
1558
|
+
"DROP TABLE `invoices`;",
|
|
1559
|
+
"ALTER TABLE `__new_invoices` RENAME TO `invoices`;",
|
|
1560
|
+
"CREATE TABLE `__new_leads` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`title` text NOT NULL,\n\t`organization_id` integer,\n\t`project_id` integer,\n\t`stage_id` integer NOT NULL,\n\t`status` text NOT NULL,\n\t`currency` text,\n\t`amount` integer,\n\t`close_date` text,\n\t`closed_date` text,\n\t`rank` real,\n\t`deal_id` integer,\n\t`account_id` integer,\n\t`external_id` text,\n\t`author_type` text NOT NULL,\n\t`author_id` integer NOT NULL,\n\t`model` text,\n\t`source` text NOT NULL,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT `fk_leads_organization_id_organizations_id_fk` FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`),\n\tCONSTRAINT `fk_leads_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n\tCONSTRAINT `fk_leads_stage_id_pipeline_stages_id_fk` FOREIGN KEY (`stage_id`) REFERENCES `pipeline_stages`(`id`),\n\tCONSTRAINT `fk_leads_deal_id_deals_id_fk` FOREIGN KEY (`deal_id`) REFERENCES `deals`(`id`),\n\tCONSTRAINT `fk_leads_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT \"leads_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\")),\n\tCONSTRAINT \"leads_amount_not_negative\" CHECK(\"amount\" IS NULL OR \"amount\" >= 0)\n);",
|
|
1561
|
+
"INSERT INTO `__new_leads`(`id`, `title`, `organization_id`, `project_id`, `stage_id`, `status`, `currency`, `amount`, `close_date`, `closed_date`, `rank`, `deal_id`, `account_id`, `external_id`, `author_type`, `author_id`, `model`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `title`, `organization_id`, `project_id`, `stage_id`, `status`, `currency`, `amount`, `close_date`, `closed_date`, `rank`, `deal_id`, `account_id`, `external_id`, `author_type`, `author_id`, `model`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at` FROM `leads`;",
|
|
1562
|
+
"DROP TABLE `leads`;",
|
|
1563
|
+
"ALTER TABLE `__new_leads` RENAME TO `leads`;",
|
|
1564
|
+
"CREATE TABLE `__new_link_reviews` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`linkable_type` text NOT NULL,\n\t`linkable_id` integer NOT NULL,\n\t`entity_type` text NOT NULL,\n\t`candidates` text NOT NULL,\n\t`reason` text NOT NULL,\n\t`status` text NOT NULL,\n\t`chosen_id` integer,\n\t`decided_by` text,\n\t`decided_at` integer,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `link_reviews_linkable_type_linkable_id_entity_type_unique` UNIQUE(`linkable_type`,`linkable_id`,`entity_type`),\n\tCONSTRAINT \"link_reviews_candidates_json\" CHECK(\"candidates\" IS NULL OR json_valid(\"candidates\"))\n);",
|
|
1565
|
+
"INSERT INTO `__new_link_reviews`(`id`, `linkable_type`, `linkable_id`, `entity_type`, `candidates`, `reason`, `status`, `chosen_id`, `decided_by`, `decided_at`, `created_at`, `updated_at`) SELECT `id`, `linkable_type`, `linkable_id`, `entity_type`, `candidates`, `reason`, `status`, `chosen_id`, `decided_by`, `decided_at`, `created_at`, `updated_at` FROM `link_reviews`;",
|
|
1566
|
+
"DROP TABLE `link_reviews`;",
|
|
1567
|
+
"ALTER TABLE `__new_link_reviews` RENAME TO `link_reviews`;",
|
|
1568
|
+
"CREATE TABLE `__new_link_revisions` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`link_id` integer NOT NULL,\n\t`change` text NOT NULL,\n\t`before` text,\n\t`after` text,\n\t`author` text,\n\t`account_id` integer,\n\t`created_at` integer NOT NULL,\n\tCONSTRAINT \"link_revisions_before_json\" CHECK(\"before\" IS NULL OR json_valid(\"before\"))\n);",
|
|
1569
|
+
"INSERT INTO `__new_link_revisions`(`id`, `link_id`, `change`, `before`, `after`, `author`, `account_id`, `created_at`) SELECT `id`, `link_id`, `change`, `before`, `after`, `author`, `account_id`, `created_at` FROM `link_revisions`;",
|
|
1570
|
+
"DROP TABLE `link_revisions`;",
|
|
1571
|
+
"ALTER TABLE `__new_link_revisions` RENAME TO `link_revisions`;",
|
|
1572
|
+
"CREATE TABLE `__new_links` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`from_type` text NOT NULL,\n\t`from_id` integer NOT NULL,\n\t`to_type` text,\n\t`to_id` integer,\n\t`kind` text NOT NULL,\n\t`anchor` text,\n\t`source` text NOT NULL,\n\t`target_text` text,\n\t`target_folded` text,\n\t`role` text,\n\t`evidence` text,\n\t`metadata` text,\n\t`confirmed` integer DEFAULT 1 NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`author` text,\n\t`updated_at` integer NOT NULL,\n\t`purpose` text,\n\t`account_id` integer,\n\t`starts_at` integer,\n\t`ends_at` integer,\n\t`deleted_at` integer,\n\tCONSTRAINT \"links_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1573
|
+
"INSERT INTO `__new_links`(`id`, `from_type`, `from_id`, `to_type`, `to_id`, `kind`, `anchor`, `source`, `target_text`, `target_folded`, `role`, `evidence`, `metadata`, `confirmed`, `created_at`, `author`, `updated_at`, `purpose`, `account_id`, `starts_at`, `ends_at`, `deleted_at`) SELECT `id`, `from_type`, `from_id`, `to_type`, `to_id`, `kind`, `anchor`, `source`, `target_text`, `target_folded`, `role`, `evidence`, `metadata`, `confirmed`, `created_at`, `author`, `updated_at`, `purpose`, `account_id`, `starts_at`, `ends_at`, `deleted_at` FROM `links`;",
|
|
1574
|
+
"DROP TABLE `links`;",
|
|
1575
|
+
"ALTER TABLE `__new_links` RENAME TO `links`;",
|
|
1576
|
+
"CREATE TABLE `__new_mail_rules` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`conditions` text NOT NULL,\n\t`actions` text NOT NULL,\n\t`protected` integer DEFAULT 0 NOT NULL,\n\t`source` text NOT NULL,\n\t`reason` text,\n\t`decided_at` integer NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_mail_rules_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `mail_rules_account_id_conditions_unique` UNIQUE(`account_id`,`conditions`),\n\tCONSTRAINT \"mail_rules_conditions_json\" CHECK(\"conditions\" IS NULL OR json_valid(\"conditions\")),\n\tCONSTRAINT \"mail_rules_actions_json\" CHECK(\"actions\" IS NULL OR json_valid(\"actions\"))\n);",
|
|
1577
|
+
"INSERT INTO `__new_mail_rules`(`id`, `account_id`, `conditions`, `actions`, `protected`, `source`, `reason`, `decided_at`, `created_at`, `updated_at`) SELECT `id`, `account_id`, `conditions`, `actions`, `protected`, `source`, `reason`, `decided_at`, `created_at`, `updated_at` FROM `mail_rules`;",
|
|
1578
|
+
"DROP TABLE `mail_rules`;",
|
|
1579
|
+
"ALTER TABLE `__new_mail_rules` RENAME TO `mail_rules`;",
|
|
1580
|
+
"CREATE TABLE `__new_meeting_chat_messages` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`meeting_id` integer NOT NULL,\n\t`external_id` text,\n\t`sent_at` integer NOT NULL,\n\t`sender_participant_id` integer,\n\t`sender_name` text,\n\t`recipient` text,\n\t`text` text NOT NULL,\n\t`normalized_text` text,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_meeting_chat_messages_meeting_id_meetings_id_fk` FOREIGN KEY (`meeting_id`) REFERENCES `meetings`(`id`),\n\tCONSTRAINT `fk_meeting_chat_messages_sender_participant_id_meeting_participants_id_fk` FOREIGN KEY (`sender_participant_id`) REFERENCES `meeting_participants`(`id`),\n\tCONSTRAINT \"meeting_chat_messages_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1581
|
+
"INSERT INTO `__new_meeting_chat_messages`(`id`, `meeting_id`, `external_id`, `sent_at`, `sender_participant_id`, `sender_name`, `recipient`, `text`, `normalized_text`, `metadata`, `created_at`, `updated_at`) SELECT `id`, `meeting_id`, `external_id`, `sent_at`, `sender_participant_id`, `sender_name`, `recipient`, `text`, `normalized_text`, `metadata`, `created_at`, `updated_at` FROM `meeting_chat_messages`;",
|
|
1582
|
+
"DROP TABLE `meeting_chat_messages`;",
|
|
1583
|
+
"ALTER TABLE `__new_meeting_chat_messages` RENAME TO `meeting_chat_messages`;",
|
|
1584
|
+
"CREATE TABLE `__new_meeting_participants` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`meeting_id` integer NOT NULL,\n\t`identity_id` integer NOT NULL,\n\t`display_name` text,\n\t`email` text,\n\t`role` text,\n\t`joined_at` integer,\n\t`left_at` integer,\n\t`duration_ms` integer,\n\t`sessions` text,\n\t`external_id` text,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_meeting_participants_meeting_id_meetings_id_fk` FOREIGN KEY (`meeting_id`) REFERENCES `meetings`(`id`),\n\tCONSTRAINT `fk_meeting_participants_identity_id_identities_id_fk` FOREIGN KEY (`identity_id`) REFERENCES `identities`(`id`),\n\tCONSTRAINT `meeting_participants_meeting_id_identity_id_unique` UNIQUE(`meeting_id`,`identity_id`),\n\tCONSTRAINT \"meeting_participants_sessions_json\" CHECK(\"sessions\" IS NULL OR json_valid(\"sessions\")),\n\tCONSTRAINT \"meeting_participants_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1585
|
+
"INSERT INTO `__new_meeting_participants`(`id`, `meeting_id`, `identity_id`, `display_name`, `email`, `role`, `joined_at`, `left_at`, `duration_ms`, `sessions`, `external_id`, `metadata`, `created_at`, `updated_at`) SELECT `id`, `meeting_id`, `identity_id`, `display_name`, `email`, `role`, `joined_at`, `left_at`, `duration_ms`, `sessions`, `external_id`, `metadata`, `created_at`, `updated_at` FROM `meeting_participants`;",
|
|
1586
|
+
"DROP TABLE `meeting_participants`;",
|
|
1587
|
+
"ALTER TABLE `__new_meeting_participants` RENAME TO `meeting_participants`;",
|
|
1588
|
+
"CREATE TABLE `__new_meeting_series` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`external_id` text NOT NULL,\n\t`event_series_id` integer,\n\t`title` text,\n\t`description` text,\n\t`kind` text,\n\t`recurrence` text,\n\t`host_identity_id` integer,\n\t`join_url` text,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT `fk_meeting_series_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `fk_meeting_series_event_series_id_event_series_id_fk` FOREIGN KEY (`event_series_id`) REFERENCES `event_series`(`id`),\n\tCONSTRAINT `fk_meeting_series_host_identity_id_identities_id_fk` FOREIGN KEY (`host_identity_id`) REFERENCES `identities`(`id`),\n\tCONSTRAINT `meeting_series_account_id_external_id_unique` UNIQUE(`account_id`,`external_id`),\n\tCONSTRAINT \"meeting_series_recurrence_json\" CHECK(\"recurrence\" IS NULL OR json_valid(\"recurrence\")),\n\tCONSTRAINT \"meeting_series_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1589
|
+
"INSERT INTO `__new_meeting_series`(`id`, `account_id`, `external_id`, `event_series_id`, `title`, `description`, `kind`, `recurrence`, `host_identity_id`, `join_url`, `metadata`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `account_id`, `external_id`, `event_series_id`, `title`, `description`, `kind`, `recurrence`, `host_identity_id`, `join_url`, `metadata`, `created_at`, `updated_at`, `deleted_at` FROM `meeting_series`;",
|
|
1590
|
+
"DROP TABLE `meeting_series`;",
|
|
1591
|
+
"ALTER TABLE `__new_meeting_series` RENAME TO `meeting_series`;",
|
|
1592
|
+
"CREATE TABLE `__new_meeting_summaries` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`meeting_id` integer NOT NULL,\n\t`source` text NOT NULL,\n\t`title` text,\n\t`overview` text,\n\t`sections` text,\n\t`next_steps` text,\n\t`content` text,\n\t`doc_url` text,\n\t`external_created_at` integer,\n\t`external_updated_at` integer,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_meeting_summaries_meeting_id_meetings_id_fk` FOREIGN KEY (`meeting_id`) REFERENCES `meetings`(`id`),\n\tCONSTRAINT `meeting_summaries_meeting_id_source_unique` UNIQUE(`meeting_id`,`source`),\n\tCONSTRAINT \"meeting_summaries_sections_json\" CHECK(\"sections\" IS NULL OR json_valid(\"sections\")),\n\tCONSTRAINT \"meeting_summaries_next_steps_json\" CHECK(\"next_steps\" IS NULL OR json_valid(\"next_steps\")),\n\tCONSTRAINT \"meeting_summaries_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1593
|
+
"INSERT INTO `__new_meeting_summaries`(`id`, `meeting_id`, `source`, `title`, `overview`, `sections`, `next_steps`, `content`, `doc_url`, `external_created_at`, `external_updated_at`, `metadata`, `created_at`, `updated_at`) SELECT `id`, `meeting_id`, `source`, `title`, `overview`, `sections`, `next_steps`, `content`, `doc_url`, `external_created_at`, `external_updated_at`, `metadata`, `created_at`, `updated_at` FROM `meeting_summaries`;",
|
|
1594
|
+
"DROP TABLE `meeting_summaries`;",
|
|
1595
|
+
"ALTER TABLE `__new_meeting_summaries` RENAME TO `meeting_summaries`;",
|
|
1596
|
+
"CREATE TABLE `__new_meeting_transcript_rows` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`meeting_transcript_id` integer NOT NULL,\n\t`position` integer NOT NULL,\n\t`start_ms` integer NOT NULL,\n\t`end_ms` integer NOT NULL,\n\t`speaker_participant_id` integer,\n\t`speaker_name` text,\n\t`text` text NOT NULL,\n\t`normalized_text` text,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\tCONSTRAINT `fk_meeting_transcript_rows_meeting_transcript_id_meeting_transcripts_id_fk` FOREIGN KEY (`meeting_transcript_id`) REFERENCES `meeting_transcripts`(`id`),\n\tCONSTRAINT `fk_meeting_transcript_rows_speaker_participant_id_meeting_participants_id_fk` FOREIGN KEY (`speaker_participant_id`) REFERENCES `meeting_participants`(`id`),\n\tCONSTRAINT `meeting_transcript_rows_meeting_transcript_id_position_unique` UNIQUE(`meeting_transcript_id`,`position`),\n\tCONSTRAINT \"meeting_transcript_rows_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1597
|
+
"INSERT INTO `__new_meeting_transcript_rows`(`id`, `meeting_transcript_id`, `position`, `start_ms`, `end_ms`, `speaker_participant_id`, `speaker_name`, `text`, `normalized_text`, `metadata`, `created_at`) SELECT `id`, `meeting_transcript_id`, `position`, `start_ms`, `end_ms`, `speaker_participant_id`, `speaker_name`, `text`, `normalized_text`, `metadata`, `created_at` FROM `meeting_transcript_rows`;",
|
|
1598
|
+
"DROP TABLE `meeting_transcript_rows`;",
|
|
1599
|
+
"ALTER TABLE `__new_meeting_transcript_rows` RENAME TO `meeting_transcript_rows`;",
|
|
1600
|
+
"CREATE TABLE `__new_meeting_transcripts` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`meeting_id` integer NOT NULL,\n\t`source` text NOT NULL,\n\t`format` text,\n\t`language` text,\n\t`content_hash` text,\n\t`external_created_at` integer,\n\t`superseded_at` integer,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT `fk_meeting_transcripts_meeting_id_meetings_id_fk` FOREIGN KEY (`meeting_id`) REFERENCES `meetings`(`id`),\n\tCONSTRAINT \"meeting_transcripts_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1601
|
+
"INSERT INTO `__new_meeting_transcripts`(`id`, `meeting_id`, `source`, `format`, `language`, `content_hash`, `external_created_at`, `superseded_at`, `metadata`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `meeting_id`, `source`, `format`, `language`, `content_hash`, `external_created_at`, `superseded_at`, `metadata`, `created_at`, `updated_at`, `deleted_at` FROM `meeting_transcripts`;",
|
|
1602
|
+
"DROP TABLE `meeting_transcripts`;",
|
|
1603
|
+
"ALTER TABLE `__new_meeting_transcripts` RENAME TO `meeting_transcripts`;",
|
|
1604
|
+
"CREATE TABLE `__new_meetings` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`meeting_series_id` integer,\n\t`event_id` integer,\n\t`external_id` text NOT NULL,\n\t`title` text,\n\t`description` text,\n\t`location` text,\n\t`join_url` text,\n\t`started_at` integer,\n\t`ended_at` integer,\n\t`duration_ms` integer,\n\t`timezone` text,\n\t`host_identity_id` integer,\n\t`participants_count` integer,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\t`title_folded` text,\n\t`join_key` text,\n\t`direction` text,\n\t`client_phone` text,\n\tCONSTRAINT `fk_meetings_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `fk_meetings_meeting_series_id_meeting_series_id_fk` FOREIGN KEY (`meeting_series_id`) REFERENCES `meeting_series`(`id`),\n\tCONSTRAINT `fk_meetings_event_id_events_id_fk` FOREIGN KEY (`event_id`) REFERENCES `events`(`id`),\n\tCONSTRAINT `fk_meetings_host_identity_id_identities_id_fk` FOREIGN KEY (`host_identity_id`) REFERENCES `identities`(`id`),\n\tCONSTRAINT `meetings_account_id_external_id_unique` UNIQUE(`account_id`,`external_id`),\n\tCONSTRAINT \"meetings_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1605
|
+
"INSERT INTO `__new_meetings`(`id`, `account_id`, `meeting_series_id`, `event_id`, `external_id`, `title`, `description`, `location`, `join_url`, `started_at`, `ended_at`, `duration_ms`, `timezone`, `host_identity_id`, `participants_count`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `title_folded`, `join_key`, `direction`, `client_phone`) SELECT `id`, `account_id`, `meeting_series_id`, `event_id`, `external_id`, `title`, `description`, `location`, `join_url`, `started_at`, `ended_at`, `duration_ms`, `timezone`, `host_identity_id`, `participants_count`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `title_folded`, `join_key`, `direction`, `client_phone` FROM `meetings`;",
|
|
1606
|
+
"DROP TABLE `meetings`;",
|
|
1607
|
+
"ALTER TABLE `__new_meetings` RENAME TO `meetings`;",
|
|
1608
|
+
"CREATE TABLE `__new_memories` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`kind` text NOT NULL,\n\t`body` text NOT NULL,\n\t`subject_type` text,\n\t`subject_id` integer,\n\t`author_type` text NOT NULL,\n\t`author_id` integer NOT NULL,\n\t`model` text,\n\t`confidence` real,\n\t`status` text NOT NULL,\n\t`last_verified_at` integer,\n\t`supersedes_id` integer,\n\t`scope` text NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\t`project_id` integer,\n\tCONSTRAINT `fk_memories_supersedes_id_memories_id_fk` FOREIGN KEY (`supersedes_id`) REFERENCES `memories`(`id`),\n\tCONSTRAINT `fk_memories_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n\tCONSTRAINT \"memories_subject_pair\" CHECK((\"subject_type\" IS NULL) = (\"subject_id\" IS NULL))\n);",
|
|
1609
|
+
"INSERT INTO `__new_memories`(`id`, `kind`, `body`, `subject_type`, `subject_id`, `author_type`, `author_id`, `model`, `confidence`, `status`, `last_verified_at`, `supersedes_id`, `scope`, `created_at`, `updated_at`, `deleted_at`, `project_id`) SELECT `id`, `kind`, `body`, `subject_type`, `subject_id`, `author_type`, `author_id`, `model`, `confidence`, `status`, `last_verified_at`, `supersedes_id`, `scope`, `created_at`, `updated_at`, `deleted_at`, `project_id` FROM `memories`;",
|
|
1610
|
+
"DROP TABLE `memories`;",
|
|
1611
|
+
"ALTER TABLE `__new_memories` RENAME TO `memories`;",
|
|
1612
|
+
"CREATE TABLE `__new_messages` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`chat_id` integer NOT NULL,\n\t`account_id` integer NOT NULL,\n\t`external_id` text NOT NULL,\n\t`thread_external_id` text,\n\t`sender_identity_id` integer,\n\t`sender_chat_external_id` text,\n\t`sender_name` text,\n\t`sent_at` integer NOT NULL,\n\t`edited_at` integer,\n\t`deleted_at` integer,\n\t`text` text NOT NULL,\n\t`reply_to_external_id` text,\n\t`reply_to` text,\n\t`forward` text,\n\t`outgoing` integer,\n\t`reactions` text,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`source` text NOT NULL,\n\t`normalized_text` text,\n\t`normalizer_version` integer,\n\t`mentions` text,\n\t`updated_at` integer NOT NULL,\n\t`thread_root_id` integer,\n\t`starred` integer,\n\t`delivery` integer,\n\tCONSTRAINT `fk_messages_chat_id_chats_id_fk` FOREIGN KEY (`chat_id`) REFERENCES `chats`(`id`),\n\tCONSTRAINT `fk_messages_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `fk_messages_sender_identity_id_identities_id_fk` FOREIGN KEY (`sender_identity_id`) REFERENCES `identities`(`id`),\n\tCONSTRAINT `fk_messages_thread_root_id_messages_id_fk` FOREIGN KEY (`thread_root_id`) REFERENCES `messages`(`id`),\n\tCONSTRAINT `messages_chat_id_external_id_unique` UNIQUE(`chat_id`,`external_id`),\n\tCONSTRAINT \"messages_reply_to_json\" CHECK(\"reply_to\" IS NULL OR json_valid(\"reply_to\")),\n\tCONSTRAINT \"messages_forward_json\" CHECK(\"forward\" IS NULL OR json_valid(\"forward\")),\n\tCONSTRAINT \"messages_reactions_json\" CHECK(\"reactions\" IS NULL OR json_valid(\"reactions\")),\n\tCONSTRAINT \"messages_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\")),\n\tCONSTRAINT \"messages_mentions_json\" CHECK(\"mentions\" IS NULL OR json_valid(\"mentions\"))\n);",
|
|
1613
|
+
"INSERT INTO `__new_messages`(`id`, `chat_id`, `account_id`, `external_id`, `thread_external_id`, `sender_identity_id`, `sender_chat_external_id`, `sender_name`, `sent_at`, `edited_at`, `deleted_at`, `text`, `reply_to_external_id`, `reply_to`, `forward`, `outgoing`, `reactions`, `metadata`, `created_at`, `source`, `normalized_text`, `normalizer_version`, `mentions`, `updated_at`, `thread_root_id`, `starred`, `delivery`) SELECT `id`, `chat_id`, `account_id`, `external_id`, `thread_external_id`, `sender_identity_id`, `sender_chat_external_id`, `sender_name`, `sent_at`, `edited_at`, `deleted_at`, `text`, `reply_to_external_id`, `reply_to`, `forward`, `outgoing`, `reactions`, `metadata`, `created_at`, `source`, `normalized_text`, `normalizer_version`, `mentions`, `updated_at`, `thread_root_id`, `starred`, `delivery` FROM `messages`;",
|
|
1614
|
+
"DROP TABLE `messages`;",
|
|
1615
|
+
"ALTER TABLE `__new_messages` RENAME TO `messages`;",
|
|
1616
|
+
"CREATE TABLE `__new_notes` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`notable_type` text NOT NULL,\n\t`notable_id` integer NOT NULL,\n\t`title` text,\n\t`body` text NOT NULL,\n\t`author_type` text,\n\t`author_id` integer,\n\t`revision` integer DEFAULT 1 NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT \"notes_author_pair\" CHECK((\"author_type\" IS NULL) = (\"author_id\" IS NULL))\n);",
|
|
1617
|
+
"INSERT INTO `__new_notes`(`id`, `notable_type`, `notable_id`, `title`, `body`, `author_type`, `author_id`, `revision`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `notable_type`, `notable_id`, `title`, `body`, `author_type`, `author_id`, `revision`, `created_at`, `updated_at`, `deleted_at` FROM `notes`;",
|
|
1618
|
+
"DROP TABLE `notes`;",
|
|
1619
|
+
"ALTER TABLE `__new_notes` RENAME TO `notes`;",
|
|
1620
|
+
"CREATE TABLE `__new_order_lines` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`order_id` integer NOT NULL,\n\t`position` integer NOT NULL,\n\t`description` text NOT NULL,\n\t`quantity` text NOT NULL,\n\t`unit_price` integer,\n\t`amount` integer NOT NULL,\n\t`catalog_item_id` integer,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_order_lines_order_id_orders_id_fk` FOREIGN KEY (`order_id`) REFERENCES `orders`(`id`),\n\tCONSTRAINT `fk_order_lines_catalog_item_id_catalog_items_id_fk` FOREIGN KEY (`catalog_item_id`) REFERENCES `catalog_items`(`id`),\n\tCONSTRAINT `order_lines_order_id_position_unique` UNIQUE(`order_id`,`position`),\n\tCONSTRAINT \"order_lines_amount_not_negative\" CHECK(\"amount\" IS NULL OR \"amount\" >= 0),\n\tCONSTRAINT \"order_lines_unit_price_not_negative\" CHECK(\"unit_price\" IS NULL OR \"unit_price\" >= 0)\n);",
|
|
1621
|
+
"INSERT INTO `__new_order_lines`(`id`, `order_id`, `position`, `description`, `quantity`, `unit_price`, `amount`, `catalog_item_id`, `created_at`, `updated_at`) SELECT `id`, `order_id`, `position`, `description`, `quantity`, `unit_price`, `amount`, `catalog_item_id`, `created_at`, `updated_at` FROM `order_lines`;",
|
|
1622
|
+
"DROP TABLE `order_lines`;",
|
|
1623
|
+
"ALTER TABLE `__new_order_lines` RENAME TO `order_lines`;",
|
|
1624
|
+
"CREATE TABLE `__new_orders` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`customer_type` text NOT NULL,\n\t`customer_id` integer NOT NULL,\n\t`purpose` text NOT NULL,\n\t`supplier_type` text,\n\t`supplier_id` integer,\n\t`supplier_name` text NOT NULL,\n\t`number` text,\n\t`currency` text,\n\t`total` integer,\n\t`status` text NOT NULL,\n\t`order_date` text,\n\t`fulfilled_date` text,\n\t`invoice_id` integer,\n\t`payment_id` integer,\n\t`project_id` integer,\n\t`review` text NOT NULL,\n\t`author_type` text NOT NULL,\n\t`author_id` integer NOT NULL,\n\t`model` text,\n\t`confirmed_by_type` text,\n\t`confirmed_by_id` integer,\n\t`source` text NOT NULL,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\t`source_url` text,\n\t`contract_id` integer,\n\t`deal_id` integer,\n\t`direction` text DEFAULT 'purchase' NOT NULL,\n\tCONSTRAINT `fk_orders_invoice_id_invoices_id_fk` FOREIGN KEY (`invoice_id`) REFERENCES `invoices`(`id`),\n\tCONSTRAINT `fk_orders_payment_id_payments_id_fk` FOREIGN KEY (`payment_id`) REFERENCES `payments`(`id`),\n\tCONSTRAINT `fk_orders_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n\tCONSTRAINT `fk_orders_contract_id_contracts_id_fk` FOREIGN KEY (`contract_id`) REFERENCES `contracts`(`id`),\n\tCONSTRAINT `fk_orders_deal_id_deals_id_fk` FOREIGN KEY (`deal_id`) REFERENCES `deals`(`id`),\n\tCONSTRAINT \"orders_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\")),\n\tCONSTRAINT \"orders_supplier_pair\" CHECK((\"supplier_type\" IS NULL) = (\"supplier_id\" IS NULL)),\n\tCONSTRAINT \"orders_confirmed_by_pair\" CHECK((\"confirmed_by_type\" IS NULL) = (\"confirmed_by_id\" IS NULL)),\n\tCONSTRAINT \"orders_total_not_negative\" CHECK(\"total\" IS NULL OR \"total\" >= 0)\n);",
|
|
1625
|
+
"INSERT INTO `__new_orders`(`id`, `customer_type`, `customer_id`, `purpose`, `supplier_type`, `supplier_id`, `supplier_name`, `number`, `currency`, `total`, `status`, `order_date`, `fulfilled_date`, `invoice_id`, `payment_id`, `project_id`, `review`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `source_url`, `contract_id`, `deal_id`, `direction`) SELECT `id`, `customer_type`, `customer_id`, `purpose`, `supplier_type`, `supplier_id`, `supplier_name`, `number`, `currency`, `total`, `status`, `order_date`, `fulfilled_date`, `invoice_id`, `payment_id`, `project_id`, `review`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `source_url`, `contract_id`, `deal_id`, `direction` FROM `orders`;",
|
|
1626
|
+
"DROP TABLE `orders`;",
|
|
1627
|
+
"ALTER TABLE `__new_orders` RENAME TO `orders`;",
|
|
1628
|
+
"CREATE TABLE `__new_organizations` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`kind` text NOT NULL,\n\t`name` text NOT NULL,\n\t`scope` text DEFAULT 'personal' NOT NULL,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT \"organizations_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\"))\n);",
|
|
1629
|
+
"INSERT INTO `__new_organizations`(`id`, `kind`, `name`, `scope`, `metadata`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `kind`, `name`, `scope`, `metadata`, `created_at`, `updated_at`, `deleted_at` FROM `organizations`;",
|
|
1630
|
+
"DROP TABLE `organizations`;",
|
|
1631
|
+
"ALTER TABLE `__new_organizations` RENAME TO `organizations`;",
|
|
1632
|
+
"CREATE TABLE `__new_payments` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`direction` text NOT NULL,\n\t`payer_type` text,\n\t`payer_id` integer,\n\t`payee_type` text,\n\t`payee_id` integer,\n\t`amount` integer NOT NULL,\n\t`currency` text NOT NULL,\n\t`payment_date` text NOT NULL,\n\t`reference` text,\n\t`project_id` integer,\n\t`review` text NOT NULL,\n\t`author_type` text NOT NULL,\n\t`author_id` integer NOT NULL,\n\t`model` text,\n\t`confirmed_by_type` text,\n\t`confirmed_by_id` integer,\n\t`source` text NOT NULL,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\t`refund_of` integer,\n\t`subscription_id` integer,\n\tCONSTRAINT `fk_payments_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n\tCONSTRAINT `fk_payments_refund_of_payments_id_fk` FOREIGN KEY (`refund_of`) REFERENCES `payments`(`id`),\n\tCONSTRAINT `fk_payments_subscription_id_subscriptions_id_fk` FOREIGN KEY (`subscription_id`) REFERENCES `subscriptions`(`id`),\n\tCONSTRAINT \"payments_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\")),\n\tCONSTRAINT \"payments_payer_pair\" CHECK((\"payer_type\" IS NULL) = (\"payer_id\" IS NULL)),\n\tCONSTRAINT \"payments_payee_pair\" CHECK((\"payee_type\" IS NULL) = (\"payee_id\" IS NULL)),\n\tCONSTRAINT \"payments_confirmed_by_pair\" CHECK((\"confirmed_by_type\" IS NULL) = (\"confirmed_by_id\" IS NULL))\n);",
|
|
1633
|
+
"INSERT INTO `__new_payments`(`id`, `direction`, `payer_type`, `payer_id`, `payee_type`, `payee_id`, `amount`, `currency`, `payment_date`, `reference`, `project_id`, `review`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `refund_of`, `subscription_id`) SELECT `id`, `direction`, `payer_type`, `payer_id`, `payee_type`, `payee_id`, `amount`, `currency`, `payment_date`, `reference`, `project_id`, `review`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `refund_of`, `subscription_id` FROM `payments`;",
|
|
1634
|
+
"DROP TABLE `payments`;",
|
|
1635
|
+
"ALTER TABLE `__new_payments` RENAME TO `payments`;",
|
|
1636
|
+
"CREATE TABLE `__new_poll_votes` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`chat_id` integer NOT NULL,\n\t`message_external_id` text NOT NULL,\n\t`identity_id` integer NOT NULL,\n\t`answers` text NOT NULL,\n\t`voted_at` integer NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_poll_votes_chat_id_chats_id_fk` FOREIGN KEY (`chat_id`) REFERENCES `chats`(`id`),\n\tCONSTRAINT `fk_poll_votes_identity_id_identities_id_fk` FOREIGN KEY (`identity_id`) REFERENCES `identities`(`id`),\n\tCONSTRAINT `poll_votes_chat_id_message_external_id_identity_id_unique` UNIQUE(`chat_id`,`message_external_id`,`identity_id`),\n\tCONSTRAINT \"poll_votes_answers_json\" CHECK(\"answers\" IS NULL OR json_valid(\"answers\"))\n);",
|
|
1637
|
+
"INSERT INTO `__new_poll_votes`(`id`, `chat_id`, `message_external_id`, `identity_id`, `answers`, `voted_at`, `created_at`, `updated_at`) SELECT `id`, `chat_id`, `message_external_id`, `identity_id`, `answers`, `voted_at`, `created_at`, `updated_at` FROM `poll_votes`;",
|
|
1638
|
+
"DROP TABLE `poll_votes`;",
|
|
1639
|
+
"ALTER TABLE `__new_poll_votes` RENAME TO `poll_votes`;",
|
|
1640
|
+
"CREATE TABLE `__new_projects` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`key` text NOT NULL UNIQUE,\n\t`name` text NOT NULL,\n\t`description` text,\n\t`type` text NOT NULL,\n\t`organization_id` integer,\n\t`account_id` integer,\n\t`scope` text DEFAULT 'personal' NOT NULL,\n\t`owner_type` text,\n\t`owner_id` integer,\n\t`tasks_count` integer DEFAULT 0 NOT NULL,\n\t`status` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\t`name_folded` text,\n\tCONSTRAINT `fk_projects_organization_id_organizations_id_fk` FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`),\n\tCONSTRAINT `fk_projects_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT \"projects_owner_pair\" CHECK((\"owner_type\" IS NULL) = (\"owner_id\" IS NULL))\n);",
|
|
1641
|
+
"INSERT INTO `__new_projects`(`id`, `key`, `name`, `description`, `type`, `organization_id`, `account_id`, `scope`, `owner_type`, `owner_id`, `tasks_count`, `status`, `created_at`, `updated_at`, `deleted_at`, `name_folded`) SELECT `id`, `key`, `name`, `description`, `type`, `organization_id`, `account_id`, `scope`, `owner_type`, `owner_id`, `tasks_count`, `status`, `created_at`, `updated_at`, `deleted_at`, `name_folded` FROM `projects`;",
|
|
1642
|
+
"DROP TABLE `projects`;",
|
|
1643
|
+
"ALTER TABLE `__new_projects` RENAME TO `projects`;",
|
|
1644
|
+
"CREATE TABLE `__new_proposed_actions` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`kind` text NOT NULL,\n\t`account_id` integer,\n\t`target_type` text,\n\t`target_id` integer,\n\t`payload` text,\n\t`reason` text,\n\t`status` text NOT NULL,\n\t`proposed_by_type` text NOT NULL,\n\t`proposed_by_id` integer NOT NULL,\n\t`decided_by_type` text,\n\t`decided_by_id` integer,\n\t`decided_at` integer,\n\t`executed_at` integer,\n\t`result` text,\n\t`error` text,\n\t`verdict` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_proposed_actions_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT \"proposed_actions_payload_json\" CHECK(\"payload\" IS NULL OR json_valid(\"payload\")),\n\tCONSTRAINT \"proposed_actions_result_json\" CHECK(\"result\" IS NULL OR json_valid(\"result\")),\n\tCONSTRAINT \"proposed_actions_target_pair\" CHECK((\"target_type\" IS NULL) = (\"target_id\" IS NULL)),\n\tCONSTRAINT \"proposed_actions_decided_by_pair\" CHECK((\"decided_by_type\" IS NULL) = (\"decided_by_id\" IS NULL))\n);",
|
|
1645
|
+
"INSERT INTO `__new_proposed_actions`(`id`, `kind`, `account_id`, `target_type`, `target_id`, `payload`, `reason`, `status`, `proposed_by_type`, `proposed_by_id`, `decided_by_type`, `decided_by_id`, `decided_at`, `executed_at`, `result`, `error`, `verdict`, `created_at`, `updated_at`) SELECT `id`, `kind`, `account_id`, `target_type`, `target_id`, `payload`, `reason`, `status`, `proposed_by_type`, `proposed_by_id`, `decided_by_type`, `decided_by_id`, `decided_at`, `executed_at`, `result`, `error`, `verdict`, `created_at`, `updated_at` FROM `proposed_actions`;",
|
|
1646
|
+
"DROP TABLE `proposed_actions`;",
|
|
1647
|
+
"ALTER TABLE `__new_proposed_actions` RENAME TO `proposed_actions`;",
|
|
1648
|
+
"CREATE TABLE `__new_records` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`type` text NOT NULL,\n\t`external_id` text NOT NULL,\n\t`fields` text NOT NULL,\n\t`revision` integer,\n\t`fingerprint` text NOT NULL,\n\t`entity_type` text,\n\t`entity_id` integer,\n\t`projected_fingerprint` text,\n\t`batch_id` text NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\t`created_entity` integer DEFAULT 0 NOT NULL,\n\tCONSTRAINT `fk_records_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `records_account_id_type_external_id_unique` UNIQUE(`account_id`,`type`,`external_id`),\n\tCONSTRAINT \"records_fields_json\" CHECK(\"fields\" IS NULL OR json_valid(\"fields\")),\n\tCONSTRAINT \"records_entity_pair\" CHECK((\"entity_type\" IS NULL) = (\"entity_id\" IS NULL))\n);",
|
|
1649
|
+
"INSERT INTO `__new_records`(`id`, `account_id`, `type`, `external_id`, `fields`, `revision`, `fingerprint`, `entity_type`, `entity_id`, `projected_fingerprint`, `batch_id`, `created_at`, `updated_at`, `deleted_at`, `created_entity`) SELECT `id`, `account_id`, `type`, `external_id`, `fields`, `revision`, `fingerprint`, `entity_type`, `entity_id`, `projected_fingerprint`, `batch_id`, `created_at`, `updated_at`, `deleted_at`, `created_entity` FROM `records`;",
|
|
1650
|
+
"DROP TABLE `records`;",
|
|
1651
|
+
"ALTER TABLE `__new_records` RENAME TO `records`;",
|
|
1652
|
+
"CREATE TABLE `__new_searches` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`name` text UNIQUE,\n\t`command` text NOT NULL,\n\t`params` text NOT NULL,\n\t`language` text NOT NULL,\n\t`version` integer NOT NULL,\n\t`fields_version` integer NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`last_run_at` integer,\n\t`runs` integer DEFAULT 0 NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT \"searches_params_json\" CHECK(\"params\" IS NULL OR json_valid(\"params\"))\n);",
|
|
1653
|
+
"INSERT INTO `__new_searches`(`id`, `name`, `command`, `params`, `language`, `version`, `fields_version`, `created_at`, `last_run_at`, `runs`, `updated_at`) SELECT `id`, `name`, `command`, `params`, `language`, `version`, `fields_version`, `created_at`, `last_run_at`, `runs`, `updated_at` FROM `searches`;",
|
|
1654
|
+
"DROP TABLE `searches`;",
|
|
1655
|
+
"ALTER TABLE `__new_searches` RENAME TO `searches`;",
|
|
1656
|
+
"CREATE TABLE `__new_subscription_prices` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`subscription_id` integer NOT NULL,\n\t`amount` integer NOT NULL,\n\t`currency` text NOT NULL,\n\t`effective_from` text NOT NULL,\n\t`review` text NOT NULL,\n\t`author_type` text NOT NULL,\n\t`author_id` integer NOT NULL,\n\t`model` text,\n\t`confirmed_by_type` text,\n\t`confirmed_by_id` integer,\n\t`source` text NOT NULL,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_subscription_prices_subscription_id_subscriptions_id_fk` FOREIGN KEY (`subscription_id`) REFERENCES `subscriptions`(`id`),\n\tCONSTRAINT \"subscription_prices_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\")),\n\tCONSTRAINT \"subscription_prices_confirmed_by_pair\" CHECK((\"confirmed_by_type\" IS NULL) = (\"confirmed_by_id\" IS NULL)),\n\tCONSTRAINT \"subscription_prices_amount_not_negative\" CHECK(\"amount\" IS NULL OR \"amount\" >= 0)\n);",
|
|
1657
|
+
"INSERT INTO `__new_subscription_prices`(`id`, `subscription_id`, `amount`, `currency`, `effective_from`, `review`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at`) SELECT `id`, `subscription_id`, `amount`, `currency`, `effective_from`, `review`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at` FROM `subscription_prices`;",
|
|
1658
|
+
"DROP TABLE `subscription_prices`;",
|
|
1659
|
+
"ALTER TABLE `__new_subscription_prices` RENAME TO `subscription_prices`;",
|
|
1660
|
+
"CREATE TABLE `__new_subscriptions` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`name` text NOT NULL,\n\t`direction` text NOT NULL,\n\t`supplier_type` text NOT NULL,\n\t`supplier_id` integer NOT NULL,\n\t`customer_type` text NOT NULL,\n\t`customer_id` integer NOT NULL,\n\t`catalog_item_id` integer,\n\t`contract_id` integer,\n\t`project_id` integer,\n\t`status` text NOT NULL,\n\t`interval_count` integer NOT NULL,\n\t`interval_unit` text NOT NULL,\n\t`start_date` text NOT NULL,\n\t`trial_end_date` text,\n\t`next_renewal_date` text,\n\t`cancelled_date` text,\n\t`end_date` text,\n\t`review` text NOT NULL,\n\t`author_type` text NOT NULL,\n\t`author_id` integer NOT NULL,\n\t`model` text,\n\t`confirmed_by_type` text,\n\t`confirmed_by_id` integer,\n\t`source` text NOT NULL,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT `fk_subscriptions_catalog_item_id_catalog_items_id_fk` FOREIGN KEY (`catalog_item_id`) REFERENCES `catalog_items`(`id`),\n\tCONSTRAINT `fk_subscriptions_contract_id_contracts_id_fk` FOREIGN KEY (`contract_id`) REFERENCES `contracts`(`id`),\n\tCONSTRAINT `fk_subscriptions_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n\tCONSTRAINT \"subscriptions_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\")),\n\tCONSTRAINT \"subscriptions_confirmed_by_pair\" CHECK((\"confirmed_by_type\" IS NULL) = (\"confirmed_by_id\" IS NULL))\n);",
|
|
1661
|
+
"INSERT INTO `__new_subscriptions`(`id`, `name`, `direction`, `supplier_type`, `supplier_id`, `customer_type`, `customer_id`, `catalog_item_id`, `contract_id`, `project_id`, `status`, `interval_count`, `interval_unit`, `start_date`, `trial_end_date`, `next_renewal_date`, `cancelled_date`, `end_date`, `review`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `name`, `direction`, `supplier_type`, `supplier_id`, `customer_type`, `customer_id`, `catalog_item_id`, `contract_id`, `project_id`, `status`, `interval_count`, `interval_unit`, `start_date`, `trial_end_date`, `next_renewal_date`, `cancelled_date`, `end_date`, `review`, `author_type`, `author_id`, `model`, `confirmed_by_type`, `confirmed_by_id`, `source`, `metadata`, `created_at`, `updated_at`, `deleted_at` FROM `subscriptions`;",
|
|
1662
|
+
"DROP TABLE `subscriptions`;",
|
|
1663
|
+
"ALTER TABLE `__new_subscriptions` RENAME TO `subscriptions`;",
|
|
1664
|
+
"CREATE TABLE `__new_syncs` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`kind` text NOT NULL,\n\t`started_at` integer NOT NULL,\n\t`finished_at` integer,\n\t`status` text NOT NULL,\n\t`counts` text,\n\t`error` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_syncs_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT \"syncs_counts_json\" CHECK(\"counts\" IS NULL OR json_valid(\"counts\"))\n);",
|
|
1665
|
+
"INSERT INTO `__new_syncs`(`id`, `account_id`, `kind`, `started_at`, `finished_at`, `status`, `counts`, `error`, `created_at`, `updated_at`) SELECT `id`, `account_id`, `kind`, `started_at`, `finished_at`, `status`, `counts`, `error`, `created_at`, `updated_at` FROM `syncs`;",
|
|
1666
|
+
"DROP TABLE `syncs`;",
|
|
1667
|
+
"ALTER TABLE `__new_syncs` RENAME TO `syncs`;",
|
|
1668
|
+
"CREATE TABLE `__new_tag_consolidations` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`source_id` integer NOT NULL,\n\t`survivor_id` integer NOT NULL,\n\t`source_member_ids` text NOT NULL,\n\t`survivor_member_ids` text NOT NULL,\n\t`actor_type` text NOT NULL,\n\t`actor_id` integer NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`idempotency_key` text NOT NULL UNIQUE,\n\t`vocabulary_fingerprint` text NOT NULL,\n\t`preview_fingerprint` text NOT NULL,\n\t`counts` text NOT NULL,\n\t`request_fingerprint` text NOT NULL,\n\tCONSTRAINT `fk_tag_consolidations_source_id_canonical_tags_id_fk` FOREIGN KEY (`source_id`) REFERENCES `canonical_tags`(`id`),\n\tCONSTRAINT `fk_tag_consolidations_survivor_id_canonical_tags_id_fk` FOREIGN KEY (`survivor_id`) REFERENCES `canonical_tags`(`id`),\n\tCONSTRAINT \"tag_consolidations_source_member_ids_json\" CHECK(\"source_member_ids\" IS NULL OR json_valid(\"source_member_ids\")),\n\tCONSTRAINT \"tag_consolidations_survivor_member_ids_json\" CHECK(\"survivor_member_ids\" IS NULL OR json_valid(\"survivor_member_ids\")),\n\tCONSTRAINT \"tag_consolidations_counts_json\" CHECK(\"counts\" IS NULL OR json_valid(\"counts\"))\n);",
|
|
1669
|
+
"INSERT INTO `__new_tag_consolidations`(`id`, `source_id`, `survivor_id`, `source_member_ids`, `survivor_member_ids`, `actor_type`, `actor_id`, `created_at`, `idempotency_key`, `vocabulary_fingerprint`, `preview_fingerprint`, `counts`, `request_fingerprint`) SELECT `id`, `source_id`, `survivor_id`, `source_member_ids`, `survivor_member_ids`, `actor_type`, `actor_id`, `created_at`, `idempotency_key`, `vocabulary_fingerprint`, `preview_fingerprint`, `counts`, `request_fingerprint` FROM `tag_consolidations`;",
|
|
1670
|
+
"DROP TABLE `tag_consolidations`;",
|
|
1671
|
+
"ALTER TABLE `__new_tag_consolidations` RENAME TO `tag_consolidations`;",
|
|
1672
|
+
"CREATE TABLE `__new_taggings` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`tag_id` integer NOT NULL,\n\t`taggable_type` text NOT NULL,\n\t`taggable_id` integer NOT NULL,\n\t`main` integer DEFAULT 0 NOT NULL,\n\t`source` text NOT NULL,\n\t`author_type` text,\n\t`author_id` integer,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_taggings_tag_id_tags_id_fk` FOREIGN KEY (`tag_id`) REFERENCES `canonical_tags`(`id`),\n\tCONSTRAINT `taggings_tag_id_taggable_type_taggable_id_unique` UNIQUE(`tag_id`,`taggable_type`,`taggable_id`),\n\tCONSTRAINT \"taggings_author_pair\" CHECK((\"author_type\" IS NULL) = (\"author_id\" IS NULL))\n);",
|
|
1673
|
+
"INSERT INTO `__new_taggings`(`id`, `tag_id`, `taggable_type`, `taggable_id`, `main`, `source`, `author_type`, `author_id`, `created_at`, `updated_at`) SELECT `id`, `tag_id`, `taggable_type`, `taggable_id`, `main`, `source`, `author_type`, `author_id`, `created_at`, `updated_at` FROM `taggings`;",
|
|
1674
|
+
"DROP TABLE `taggings`;",
|
|
1675
|
+
"ALTER TABLE `__new_taggings` RENAME TO `taggings`;",
|
|
1676
|
+
"CREATE TABLE `__new_task_events` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`task_id` integer NOT NULL,\n\t`actor_type` text,\n\t`actor_id` integer,\n\t`kind` text NOT NULL,\n\t`changes` text,\n\t`created_at` integer NOT NULL,\n\tCONSTRAINT `fk_task_events_task_id_tasks_id_fk` FOREIGN KEY (`task_id`) REFERENCES `tasks`(`id`),\n\tCONSTRAINT \"task_events_changes_json\" CHECK(\"changes\" IS NULL OR json_valid(\"changes\")),\n\tCONSTRAINT \"task_events_actor_pair\" CHECK((\"actor_type\" IS NULL) = (\"actor_id\" IS NULL))\n);",
|
|
1677
|
+
"INSERT INTO `__new_task_events`(`id`, `task_id`, `actor_type`, `actor_id`, `kind`, `changes`, `created_at`) SELECT `id`, `task_id`, `actor_type`, `actor_id`, `kind`, `changes`, `created_at` FROM `task_events`;",
|
|
1678
|
+
"DROP TABLE `task_events`;",
|
|
1679
|
+
"ALTER TABLE `__new_task_events` RENAME TO `task_events`;",
|
|
1680
|
+
"CREATE TABLE `__new_task_pairs` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`task_id` integer,\n\t`source_locator` text,\n\t`other_id` integer NOT NULL,\n\t`score` integer NOT NULL,\n\t`band` text NOT NULL,\n\t`levels` text NOT NULL,\n\t`reasons` text NOT NULL,\n\t`decision` text NOT NULL,\n\t`decided_by_type` text,\n\t`decided_by_id` integer,\n\t`decided_at` integer,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_task_pairs_task_id_tasks_id_fk` FOREIGN KEY (`task_id`) REFERENCES `tasks`(`id`),\n\tCONSTRAINT `fk_task_pairs_other_id_tasks_id_fk` FOREIGN KEY (`other_id`) REFERENCES `tasks`(`id`),\n\tCONSTRAINT `task_pairs_task_id_other_id_unique` UNIQUE(`task_id`,`other_id`),\n\tCONSTRAINT \"task_pairs_levels_json\" CHECK(\"levels\" IS NULL OR json_valid(\"levels\")),\n\tCONSTRAINT \"task_pairs_reasons_json\" CHECK(\"reasons\" IS NULL OR json_valid(\"reasons\")),\n\tCONSTRAINT \"task_pairs_decided_by_pair\" CHECK((\"decided_by_type\" IS NULL) = (\"decided_by_id\" IS NULL))\n);",
|
|
1681
|
+
"INSERT INTO `__new_task_pairs`(`id`, `task_id`, `source_locator`, `other_id`, `score`, `band`, `levels`, `reasons`, `decision`, `decided_by_type`, `decided_by_id`, `decided_at`, `created_at`, `updated_at`) SELECT `id`, `task_id`, `source_locator`, `other_id`, `score`, `band`, `levels`, `reasons`, `decision`, `decided_by_type`, `decided_by_id`, `decided_at`, `created_at`, `updated_at` FROM `task_pairs`;",
|
|
1682
|
+
"DROP TABLE `task_pairs`;",
|
|
1683
|
+
"ALTER TABLE `__new_task_pairs` RENAME TO `task_pairs`;",
|
|
1684
|
+
"CREATE TABLE `__new_tasks` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`project_id` integer NOT NULL,\n\t`number` integer NOT NULL,\n\t`key` text NOT NULL UNIQUE,\n\t`title` text NOT NULL,\n\t`description` text,\n\t`type` text NOT NULL,\n\t`status` text NOT NULL,\n\t`priority` integer,\n\t`parent_id` integer,\n\t`due_at` integer,\n\t`started_at` integer,\n\t`closed_at` integer,\n\t`closed_by_type` text,\n\t`closed_by_id` integer,\n\t`close_reason` text,\n\t`author_type` text NOT NULL,\n\t`author_id` integer NOT NULL,\n\t`source` text NOT NULL,\n\t`package_id` text UNIQUE,\n\t`source_locator` text,\n\t`source_kind` text,\n\t`source_group` text,\n\t`resolution` text,\n\t`verdict` text,\n\t`metadata` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\t`next_check_at` integer,\n\t`title_folded` text,\n\t`close_reason_folded` text,\n\t`category` text,\n\t`claimed_by` text,\n\t`claimed_until` integer,\n\t`close_certainty` real,\n\t`close_suggested_as` text,\n\t`close_suggested_by_type` text,\n\t`close_suggested_by_id` integer,\n\t`close_suggested_certainty` real,\n\t`close_suggested_reason` text,\n\t`close_suggested_at` integer,\n\t`priority_score` real,\n\t`agent` text,\n\t`revision` integer DEFAULT 1 NOT NULL,\n\t`provider` text,\n\t`external_id` text,\n\t`source_url` text,\n\tCONSTRAINT `fk_tasks_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n\tCONSTRAINT `fk_tasks_parent_id_tasks_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `tasks`(`id`),\n\tCONSTRAINT `tasks_project_id_number_unique` UNIQUE(`project_id`,`number`),\n\tCONSTRAINT \"tasks_metadata_json\" CHECK(\"metadata\" IS NULL OR json_valid(\"metadata\")),\n\tCONSTRAINT \"tasks_closed_by_pair\" CHECK((\"closed_by_type\" IS NULL) = (\"closed_by_id\" IS NULL)),\n\tCONSTRAINT \"tasks_close_suggested_by_pair\" CHECK((\"close_suggested_by_type\" IS NULL) = (\"close_suggested_by_id\" IS NULL))\n);",
|
|
1685
|
+
"INSERT INTO `__new_tasks`(`id`, `project_id`, `number`, `key`, `title`, `description`, `type`, `status`, `priority`, `parent_id`, `due_at`, `started_at`, `closed_at`, `closed_by_type`, `closed_by_id`, `close_reason`, `author_type`, `author_id`, `source`, `package_id`, `source_locator`, `source_kind`, `source_group`, `resolution`, `verdict`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `next_check_at`, `title_folded`, `close_reason_folded`, `category`, `claimed_by`, `claimed_until`, `close_certainty`, `close_suggested_as`, `close_suggested_by_type`, `close_suggested_by_id`, `close_suggested_certainty`, `close_suggested_reason`, `close_suggested_at`, `priority_score`, `agent`, `revision`, `provider`, `external_id`, `source_url`) SELECT `id`, `project_id`, `number`, `key`, `title`, `description`, `type`, `status`, `priority`, `parent_id`, `due_at`, `started_at`, `closed_at`, `closed_by_type`, `closed_by_id`, `close_reason`, `author_type`, `author_id`, `source`, `package_id`, `source_locator`, `source_kind`, `source_group`, `resolution`, `verdict`, `metadata`, `created_at`, `updated_at`, `deleted_at`, `next_check_at`, `title_folded`, `close_reason_folded`, `category`, `claimed_by`, `claimed_until`, `close_certainty`, `close_suggested_as`, `close_suggested_by_type`, `close_suggested_by_id`, `close_suggested_certainty`, `close_suggested_reason`, `close_suggested_at`, `priority_score`, `agent`, `revision`, `provider`, `external_id`, `source_url` FROM `tasks`;",
|
|
1686
|
+
"DROP TABLE `tasks`;",
|
|
1687
|
+
"ALTER TABLE `__new_tasks` RENAME TO `tasks`;",
|
|
1688
|
+
"CREATE TABLE `__new_tracker_items` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`kind` text NOT NULL,\n\t`external_id` text NOT NULL,\n\t`parent_id` text,\n\t`title` text NOT NULL,\n\t`title_folded` text NOT NULL,\n\t`body` text,\n\t`normalized_text` text NOT NULL,\n\t`data` text NOT NULL,\n\t`source_created_at` integer,\n\t`source_updated_at` integer,\n\t`archived_at` integer,\n\t`deleted_at` integer,\n\t`synced_at` integer NOT NULL,\n\tCONSTRAINT `fk_tracker_items_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `tracker_items_account_id_kind_external_id_unique` UNIQUE(`account_id`,`kind`,`external_id`),\n\tCONSTRAINT \"tracker_items_data_json\" CHECK(\"data\" IS NULL OR json_valid(\"data\"))\n);",
|
|
1689
|
+
"INSERT INTO `__new_tracker_items`(`id`, `account_id`, `kind`, `external_id`, `parent_id`, `title`, `title_folded`, `body`, `normalized_text`, `data`, `source_created_at`, `source_updated_at`, `archived_at`, `deleted_at`, `synced_at`) SELECT `id`, `account_id`, `kind`, `external_id`, `parent_id`, `title`, `title_folded`, `body`, `normalized_text`, `data`, `source_created_at`, `source_updated_at`, `archived_at`, `deleted_at`, `synced_at` FROM `tracker_items`;",
|
|
1690
|
+
"DROP TABLE `tracker_items`;",
|
|
1691
|
+
"ALTER TABLE `__new_tracker_items` RENAME TO `tracker_items`;",
|
|
1692
|
+
"CREATE TABLE `__new_aliases` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`aliasable_type` text NOT NULL,\n\t`aliasable_id` integer NOT NULL,\n\t`account_id` integer,\n\t`name` text NOT NULL,\n\t`name_folded` text NOT NULL,\n\t`display` integer DEFAULT 0 NOT NULL,\n\t`source` text NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_aliases_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`)\n);",
|
|
1693
|
+
"INSERT INTO `__new_aliases`(`id`, `aliasable_type`, `aliasable_id`, `account_id`, `name`, `name_folded`, `display`, `source`, `created_at`, `updated_at`) SELECT `id`, `aliasable_type`, `aliasable_id`, `account_id`, `name`, `name_folded`, `display`, `source`, `created_at`, `updated_at` FROM `aliases`;",
|
|
1694
|
+
"DROP TABLE `aliases`;",
|
|
1695
|
+
"ALTER TABLE `__new_aliases` RENAME TO `aliases`;",
|
|
1696
|
+
"CREATE TABLE `__new_calendar_entry_participants` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`entry_id` integer NOT NULL,\n\t`identity_id` integer,\n\t`email` text NOT NULL,\n\t`name` text,\n\t`response` text,\n\t`optional` integer NOT NULL,\n\t`organizer` integer NOT NULL,\n\t`self` integer NOT NULL,\n\t`resource` integer NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_calendar_entry_participants_entry_id_calendar_entries_id_fk` FOREIGN KEY (`entry_id`) REFERENCES `calendar_entries`(`id`),\n\tCONSTRAINT `fk_calendar_entry_participants_identity_id_identities_id_fk` FOREIGN KEY (`identity_id`) REFERENCES `identities`(`id`),\n\tCONSTRAINT `calendar_entry_participants_entry_id_email_unique` UNIQUE(`entry_id`,`email`)\n);",
|
|
1697
|
+
"INSERT INTO `__new_calendar_entry_participants`(`id`, `entry_id`, `identity_id`, `email`, `name`, `response`, `optional`, `organizer`, `self`, `resource`, `created_at`, `updated_at`) SELECT `id`, `entry_id`, `identity_id`, `email`, `name`, `response`, `optional`, `organizer`, `self`, `resource`, `created_at`, `updated_at` FROM `calendar_entry_participants`;",
|
|
1698
|
+
"DROP TABLE `calendar_entry_participants`;",
|
|
1699
|
+
"ALTER TABLE `__new_calendar_entry_participants` RENAME TO `calendar_entry_participants`;",
|
|
1700
|
+
"CREATE TABLE `__new_calendar_entry_revisions` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`entry_id` integer NOT NULL,\n\t`title` text,\n\t`starts_at` integer,\n\t`ends_at` integer,\n\t`location` text,\n\t`status` text,\n\t`recurrence` text,\n\t`recurrence_ends_at` integer,\n\t`external_updated_at` integer,\n\t`created_at` integer NOT NULL,\n\tCONSTRAINT `fk_calendar_entry_revisions_entry_id_calendar_entries_id_fk` FOREIGN KEY (`entry_id`) REFERENCES `calendar_entries`(`id`)\n);",
|
|
1701
|
+
"INSERT INTO `__new_calendar_entry_revisions`(`id`, `entry_id`, `title`, `starts_at`, `ends_at`, `location`, `status`, `recurrence`, `recurrence_ends_at`, `external_updated_at`, `created_at`) SELECT `id`, `entry_id`, `title`, `starts_at`, `ends_at`, `location`, `status`, `recurrence`, `recurrence_ends_at`, `external_updated_at`, `created_at` FROM `calendar_entry_revisions`;",
|
|
1702
|
+
"DROP TABLE `calendar_entry_revisions`;",
|
|
1703
|
+
"ALTER TABLE `__new_calendar_entry_revisions` RENAME TO `calendar_entry_revisions`;",
|
|
1704
|
+
"CREATE TABLE `__new_calendars` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`external_id` text NOT NULL,\n\t`title` text,\n\t`timezone` text,\n\t`access_role` text,\n\t`primary_calendar` integer NOT NULL,\n\t`synced` integer NOT NULL,\n\t`seen_at` integer,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT `fk_calendars_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `calendars_account_id_external_id_unique` UNIQUE(`account_id`,`external_id`)\n);",
|
|
1705
|
+
"INSERT INTO `__new_calendars`(`id`, `account_id`, `external_id`, `title`, `timezone`, `access_role`, `primary_calendar`, `synced`, `seen_at`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `account_id`, `external_id`, `title`, `timezone`, `access_role`, `primary_calendar`, `synced`, `seen_at`, `created_at`, `updated_at`, `deleted_at` FROM `calendars`;",
|
|
1706
|
+
"DROP TABLE `calendars`;",
|
|
1707
|
+
"ALTER TABLE `__new_calendars` RENAME TO `calendars`;",
|
|
1708
|
+
"CREATE TABLE `__new_canonical_tags` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`name` text NOT NULL UNIQUE,\n\t`kind` text DEFAULT 'tag' NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL\n);",
|
|
1709
|
+
"INSERT INTO `__new_canonical_tags`(`id`, `name`, `kind`, `created_at`, `updated_at`) SELECT `id`, `name`, `kind`, `created_at`, `updated_at` FROM `canonical_tags`;",
|
|
1710
|
+
"DROP TABLE `canonical_tags`;",
|
|
1711
|
+
"ALTER TABLE `__new_canonical_tags` RENAME TO `canonical_tags`;",
|
|
1712
|
+
"CREATE TABLE `__new_chat_events` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`chat_id` integer NOT NULL,\n\t`source_id` text NOT NULL,\n\t`action` text NOT NULL,\n\t`actor_identity_id` integer,\n\t`title` text,\n\t`happened_at` integer NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_chat_events_chat_id_chats_id_fk` FOREIGN KEY (`chat_id`) REFERENCES `chats`(`id`),\n\tCONSTRAINT `fk_chat_events_actor_identity_id_identities_id_fk` FOREIGN KEY (`actor_identity_id`) REFERENCES `identities`(`id`),\n\tCONSTRAINT `chat_events_chat_id_source_id_unique` UNIQUE(`chat_id`,`source_id`)\n);",
|
|
1713
|
+
"INSERT INTO `__new_chat_events`(`id`, `chat_id`, `source_id`, `action`, `actor_identity_id`, `title`, `happened_at`, `created_at`, `updated_at`) SELECT `id`, `chat_id`, `source_id`, `action`, `actor_identity_id`, `title`, `happened_at`, `created_at`, `updated_at` FROM `chat_events`;",
|
|
1714
|
+
"DROP TABLE `chat_events`;",
|
|
1715
|
+
"ALTER TABLE `__new_chat_events` RENAME TO `chat_events`;",
|
|
1716
|
+
"CREATE TABLE `__new_chat_revision_source` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`source` text NOT NULL,\n\t`at` integer NOT NULL\n);",
|
|
1717
|
+
"INSERT INTO `__new_chat_revision_source`(`id`, `source`, `at`) SELECT `id`, `source`, `at` FROM `chat_revision_source`;",
|
|
1718
|
+
"DROP TABLE `chat_revision_source`;",
|
|
1719
|
+
"ALTER TABLE `__new_chat_revision_source` RENAME TO `chat_revision_source`;",
|
|
1720
|
+
"CREATE TABLE `__new_chat_revisions` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`chat_id` integer NOT NULL,\n\t`account_id` integer NOT NULL,\n\t`field` text NOT NULL,\n\t`old_value` text,\n\t`new_value` text,\n\t`source` text,\n\t`created_at` integer NOT NULL\n);",
|
|
1721
|
+
"INSERT INTO `__new_chat_revisions`(`id`, `chat_id`, `account_id`, `field`, `old_value`, `new_value`, `source`, `created_at`) SELECT `id`, `chat_id`, `account_id`, `field`, `old_value`, `new_value`, `source`, `created_at` FROM `chat_revisions`;",
|
|
1722
|
+
"DROP TABLE `chat_revisions`;",
|
|
1723
|
+
"ALTER TABLE `__new_chat_revisions` RENAME TO `chat_revisions`;",
|
|
1724
|
+
"CREATE TABLE `__new_content_channels` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`external_id` text NOT NULL,\n\t`kind` text NOT NULL,\n\t`network` text NOT NULL,\n\t`name` text NOT NULL,\n\t`url` text,\n\t`handle` text,\n\t`deleted_at` integer,\n\t`synced_at` integer NOT NULL,\n\tCONSTRAINT `fk_content_channels_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `content_channels_account_id_external_id_unique` UNIQUE(`account_id`,`external_id`)\n);",
|
|
1725
|
+
"INSERT INTO `__new_content_channels`(`id`, `account_id`, `external_id`, `kind`, `network`, `name`, `url`, `handle`, `deleted_at`, `synced_at`) SELECT `id`, `account_id`, `external_id`, `kind`, `network`, `name`, `url`, `handle`, `deleted_at`, `synced_at` FROM `content_channels`;",
|
|
1726
|
+
"DROP TABLE `content_channels`;",
|
|
1727
|
+
"ALTER TABLE `__new_content_channels` RENAME TO `content_channels`;",
|
|
1728
|
+
"CREATE TABLE `__new_content_post_revisions` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`post_id` integer NOT NULL,\n\t`title` text,\n\t`body` text,\n\t`status` text NOT NULL,\n\t`content_hash` text NOT NULL,\n\t`version` text,\n\t`reason` text NOT NULL,\n\t`created_at` integer NOT NULL,\n\tCONSTRAINT `fk_content_post_revisions_post_id_content_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `content_posts`(`id`)\n);",
|
|
1729
|
+
"INSERT INTO `__new_content_post_revisions`(`id`, `post_id`, `title`, `body`, `status`, `content_hash`, `version`, `reason`, `created_at`) SELECT `id`, `post_id`, `title`, `body`, `status`, `content_hash`, `version`, `reason`, `created_at` FROM `content_post_revisions`;",
|
|
1730
|
+
"DROP TABLE `content_post_revisions`;",
|
|
1731
|
+
"ALTER TABLE `__new_content_post_revisions` RENAME TO `content_post_revisions`;",
|
|
1732
|
+
"CREATE TABLE `__new_conversations` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`chat_id` integer NOT NULL,\n\t`first_message_id` integer NOT NULL,\n\t`build` integer NOT NULL,\n\t`first_at` integer NOT NULL,\n\t`last_at` integer NOT NULL,\n\t`message_count` integer NOT NULL,\n\t`built_at` integer NOT NULL,\n\t`algorithm_version` integer NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_conversations_chat_id_chats_id_fk` FOREIGN KEY (`chat_id`) REFERENCES `chats`(`id`) ON DELETE CASCADE,\n\tCONSTRAINT `fk_conversations_first_message_id_messages_id_fk` FOREIGN KEY (`first_message_id`) REFERENCES `messages`(`id`) ON DELETE CASCADE\n);",
|
|
1733
|
+
"INSERT INTO `__new_conversations`(`id`, `chat_id`, `first_message_id`, `build`, `first_at`, `last_at`, `message_count`, `built_at`, `algorithm_version`, `created_at`, `updated_at`) SELECT `id`, `chat_id`, `first_message_id`, `build`, `first_at`, `last_at`, `message_count`, `built_at`, `algorithm_version`, `created_at`, `updated_at` FROM `conversations`;",
|
|
1734
|
+
"DROP TABLE `conversations`;",
|
|
1735
|
+
"ALTER TABLE `__new_conversations` RENAME TO `conversations`;",
|
|
1736
|
+
"CREATE TABLE `__new_crm_files` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`external_id` text NOT NULL,\n\t`owner_kind` text NOT NULL,\n\t`owner_id` text NOT NULL,\n\t`owner_assignee` text,\n\t`source` text NOT NULL,\n\t`name` text NOT NULL,\n\t`name_folded` text NOT NULL,\n\t`mime` text,\n\t`size` integer,\n\t`external_created_at` integer,\n\t`local_path` text,\n\t`content_sha256` text,\n\t`text` text,\n\t`normalized_text` text,\n\t`extraction` text,\n\t`extraction_error` text,\n\t`downloaded_by` text,\n\t`downloaded_at` integer NOT NULL,\n\tCONSTRAINT `fk_crm_files_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `crm_files_account_id_external_id_unique` UNIQUE(`account_id`,`external_id`)\n);",
|
|
1737
|
+
"INSERT INTO `__new_crm_files`(`id`, `account_id`, `external_id`, `owner_kind`, `owner_id`, `owner_assignee`, `source`, `name`, `name_folded`, `mime`, `size`, `external_created_at`, `local_path`, `content_sha256`, `text`, `normalized_text`, `extraction`, `extraction_error`, `downloaded_by`, `downloaded_at`) SELECT `id`, `account_id`, `external_id`, `owner_kind`, `owner_id`, `owner_assignee`, `source`, `name`, `name_folded`, `mime`, `size`, `external_created_at`, `local_path`, `content_sha256`, `text`, `normalized_text`, `extraction`, `extraction_error`, `downloaded_by`, `downloaded_at` FROM `crm_files`;",
|
|
1738
|
+
"DROP TABLE `crm_files`;",
|
|
1739
|
+
"ALTER TABLE `__new_crm_files` RENAME TO `crm_files`;",
|
|
1740
|
+
"CREATE TABLE `__new_decision_requests` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`token_digest` text NOT NULL UNIQUE,\n\t`proposal_id` text NOT NULL,\n\t`action` text NOT NULL,\n\t`batch_digest` text NOT NULL,\n\t`channel` text NOT NULL,\n\t`bot_profile` text NOT NULL,\n\t`chat_id` text NOT NULL,\n\t`message_id` text NOT NULL,\n\t`owner_user_id` text NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`expires_at` integer NOT NULL,\n\t`used_at` integer,\n\t`cancelled_at` integer\n);",
|
|
1741
|
+
"INSERT INTO `__new_decision_requests`(`id`, `token_digest`, `proposal_id`, `action`, `batch_digest`, `channel`, `bot_profile`, `chat_id`, `message_id`, `owner_user_id`, `created_at`, `expires_at`, `used_at`, `cancelled_at`) SELECT `id`, `token_digest`, `proposal_id`, `action`, `batch_digest`, `channel`, `bot_profile`, `chat_id`, `message_id`, `owner_user_id`, `created_at`, `expires_at`, `used_at`, `cancelled_at` FROM `decision_requests`;",
|
|
1742
|
+
"DROP TABLE `decision_requests`;",
|
|
1743
|
+
"ALTER TABLE `__new_decision_requests` RENAME TO `decision_requests`;",
|
|
1744
|
+
"CREATE TABLE `__new_document_changes` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`document_id` integer NOT NULL,\n\t`path` text NOT NULL,\n\t`title` text,\n\t`event` text NOT NULL,\n\t`revision` integer NOT NULL,\n\t`at` integer NOT NULL\n);",
|
|
1745
|
+
"INSERT INTO `__new_document_changes`(`id`, `account_id`, `document_id`, `path`, `title`, `event`, `revision`, `at`) SELECT `id`, `account_id`, `document_id`, `path`, `title`, `event`, `revision`, `at` FROM `document_changes`;",
|
|
1746
|
+
"DROP TABLE `document_changes`;",
|
|
1747
|
+
"ALTER TABLE `__new_document_changes` RENAME TO `document_changes`;",
|
|
1748
|
+
"CREATE TABLE `__new_email_recipients` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`email_id` integer NOT NULL,\n\t`identity_id` integer,\n\t`address` text NOT NULL,\n\t`name` text,\n\t`role` text NOT NULL,\n\t`position` integer NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_email_recipients_email_id_emails_id_fk` FOREIGN KEY (`email_id`) REFERENCES `emails`(`id`),\n\tCONSTRAINT `fk_email_recipients_identity_id_identities_id_fk` FOREIGN KEY (`identity_id`) REFERENCES `identities`(`id`)\n);",
|
|
1749
|
+
"INSERT INTO `__new_email_recipients`(`id`, `email_id`, `identity_id`, `address`, `name`, `role`, `position`, `created_at`, `updated_at`) SELECT `id`, `email_id`, `identity_id`, `address`, `name`, `role`, `position`, `created_at`, `updated_at` FROM `email_recipients`;",
|
|
1750
|
+
"DROP TABLE `email_recipients`;",
|
|
1751
|
+
"ALTER TABLE `__new_email_recipients` RENAME TO `email_recipients`;",
|
|
1752
|
+
"CREATE TABLE `__new_entity_link_events` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`linkable_type` text NOT NULL,\n\t`linkable_id` integer NOT NULL,\n\t`entity_type` text NOT NULL,\n\t`from_entity_id` integer,\n\t`to_entity_id` integer,\n\t`method` text NOT NULL,\n\t`confidence` real,\n\t`author` text NOT NULL,\n\t`created_at` integer NOT NULL\n);",
|
|
1753
|
+
"INSERT INTO `__new_entity_link_events`(`id`, `linkable_type`, `linkable_id`, `entity_type`, `from_entity_id`, `to_entity_id`, `method`, `confidence`, `author`, `created_at`) SELECT `id`, `linkable_type`, `linkable_id`, `entity_type`, `from_entity_id`, `to_entity_id`, `method`, `confidence`, `author`, `created_at` FROM `entity_link_events`;",
|
|
1754
|
+
"DROP TABLE `entity_link_events`;",
|
|
1755
|
+
"ALTER TABLE `__new_entity_link_events` RENAME TO `entity_link_events`;",
|
|
1756
|
+
"CREATE TABLE `__new_event_series` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`title` text,\n\t`recurrence` text,\n\t`origin` text NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL\n);",
|
|
1757
|
+
"INSERT INTO `__new_event_series`(`id`, `title`, `recurrence`, `origin`, `created_at`, `updated_at`) SELECT `id`, `title`, `recurrence`, `origin`, `created_at`, `updated_at` FROM `event_series`;",
|
|
1758
|
+
"DROP TABLE `event_series`;",
|
|
1759
|
+
"ALTER TABLE `__new_event_series` RENAME TO `event_series`;",
|
|
1760
|
+
"CREATE TABLE `__new_events` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`event_series_id` integer,\n\t`title` text,\n\t`description` text,\n\t`location` text,\n\t`starts_at` integer,\n\t`ends_at` integer,\n\t`timezone` text,\n\t`origin` text NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\t`status` text,\n\t`all_day` integer,\n\t`source_deleted_at` integer,\n\tCONSTRAINT `fk_events_event_series_id_event_series_id_fk` FOREIGN KEY (`event_series_id`) REFERENCES `event_series`(`id`)\n);",
|
|
1761
|
+
"INSERT INTO `__new_events`(`id`, `event_series_id`, `title`, `description`, `location`, `starts_at`, `ends_at`, `timezone`, `origin`, `created_at`, `updated_at`, `deleted_at`, `status`, `all_day`, `source_deleted_at`) SELECT `id`, `event_series_id`, `title`, `description`, `location`, `starts_at`, `ends_at`, `timezone`, `origin`, `created_at`, `updated_at`, `deleted_at`, `status`, `all_day`, `source_deleted_at` FROM `events`;",
|
|
1762
|
+
"DROP TABLE `events`;",
|
|
1763
|
+
"ALTER TABLE `__new_events` RENAME TO `events`;",
|
|
1764
|
+
"CREATE TABLE `__new_fact_removals` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`fact_id` integer NOT NULL,\n\t`subject` text,\n\t`removed_by` text NOT NULL,\n\t`bot` text,\n\t`reason` text,\n\t`removed_at` integer NOT NULL\n);",
|
|
1765
|
+
"INSERT INTO `__new_fact_removals`(`id`, `fact_id`, `subject`, `removed_by`, `bot`, `reason`, `removed_at`) SELECT `id`, `fact_id`, `subject`, `removed_by`, `bot`, `reason`, `removed_at` FROM `fact_removals`;",
|
|
1766
|
+
"DROP TABLE `fact_removals`;",
|
|
1767
|
+
"ALTER TABLE `__new_fact_removals` RENAME TO `fact_removals`;",
|
|
1768
|
+
"CREATE TABLE `__new_identity_link_events` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`identity_id` integer NOT NULL,\n\t`from_person_id` integer,\n\t`to_person_id` integer NOT NULL,\n\t`method` text NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`author` text NOT NULL,\n\tCONSTRAINT `fk_identity_link_events_identity_id_identities_id_fk` FOREIGN KEY (`identity_id`) REFERENCES `identities`(`id`),\n\tCONSTRAINT `fk_identity_link_events_from_person_id_persons_id_fk` FOREIGN KEY (`from_person_id`) REFERENCES `persons`(`id`),\n\tCONSTRAINT `fk_identity_link_events_to_person_id_persons_id_fk` FOREIGN KEY (`to_person_id`) REFERENCES `persons`(`id`)\n);",
|
|
1769
|
+
"INSERT INTO `__new_identity_link_events`(`id`, `identity_id`, `from_person_id`, `to_person_id`, `method`, `created_at`, `author`) SELECT `id`, `identity_id`, `from_person_id`, `to_person_id`, `method`, `created_at`, `author` FROM `identity_link_events`;",
|
|
1770
|
+
"DROP TABLE `identity_link_events`;",
|
|
1771
|
+
"ALTER TABLE `__new_identity_link_events` RENAME TO `identity_link_events`;",
|
|
1772
|
+
"CREATE TABLE `__new_mailboxes` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer NOT NULL,\n\t`external_id` text NOT NULL,\n\t`name` text NOT NULL,\n\t`kind` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`name_folded` text,\n\tCONSTRAINT `fk_mailboxes_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `mailboxes_account_id_external_id_unique` UNIQUE(`account_id`,`external_id`)\n);",
|
|
1773
|
+
"INSERT INTO `__new_mailboxes`(`id`, `account_id`, `external_id`, `name`, `kind`, `created_at`, `updated_at`, `name_folded`) SELECT `id`, `account_id`, `external_id`, `name`, `kind`, `created_at`, `updated_at`, `name_folded` FROM `mailboxes`;",
|
|
1774
|
+
"DROP TABLE `mailboxes`;",
|
|
1775
|
+
"ALTER TABLE `__new_mailboxes` RENAME TO `mailboxes`;",
|
|
1776
|
+
"CREATE TABLE `__new_member_observations` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`chat_id` integer NOT NULL,\n\t`observed_at` integer NOT NULL,\n\t`started_at` integer,\n\t`complete` integer NOT NULL,\n\t`reported_count` integer,\n\t`listed_count` integer NOT NULL,\n\t`source` text NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_member_observations_chat_id_chats_id_fk` FOREIGN KEY (`chat_id`) REFERENCES `chats`(`id`)\n);",
|
|
1777
|
+
"INSERT INTO `__new_member_observations`(`id`, `chat_id`, `observed_at`, `started_at`, `complete`, `reported_count`, `listed_count`, `source`, `created_at`, `updated_at`) SELECT `id`, `chat_id`, `observed_at`, `started_at`, `complete`, `reported_count`, `listed_count`, `source`, `created_at`, `updated_at` FROM `member_observations`;",
|
|
1778
|
+
"DROP TABLE `member_observations`;",
|
|
1779
|
+
"ALTER TABLE `__new_member_observations` RENAME TO `member_observations`;",
|
|
1780
|
+
"CREATE TABLE `__new_member_stays` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`chat_id` integer NOT NULL,\n\t`identity_id` integer NOT NULL,\n\t`first_seen_at` integer NOT NULL,\n\t`last_seen_at` integer NOT NULL,\n\t`joined_at` integer,\n\t`invited_by_identity_id` integer,\n\t`role` text,\n\t`left_at` integer,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_member_stays_chat_id_chats_id_fk` FOREIGN KEY (`chat_id`) REFERENCES `chats`(`id`),\n\tCONSTRAINT `fk_member_stays_identity_id_identities_id_fk` FOREIGN KEY (`identity_id`) REFERENCES `identities`(`id`),\n\tCONSTRAINT `fk_member_stays_invited_by_identity_id_identities_id_fk` FOREIGN KEY (`invited_by_identity_id`) REFERENCES `identities`(`id`)\n);",
|
|
1781
|
+
"INSERT INTO `__new_member_stays`(`id`, `chat_id`, `identity_id`, `first_seen_at`, `last_seen_at`, `joined_at`, `invited_by_identity_id`, `role`, `left_at`, `created_at`, `updated_at`) SELECT `id`, `chat_id`, `identity_id`, `first_seen_at`, `last_seen_at`, `joined_at`, `invited_by_identity_id`, `role`, `left_at`, `created_at`, `updated_at` FROM `member_stays`;",
|
|
1782
|
+
"DROP TABLE `member_stays`;",
|
|
1783
|
+
"ALTER TABLE `__new_member_stays` RENAME TO `member_stays`;",
|
|
1784
|
+
"CREATE TABLE `__new_message_links` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`chat_id` integer NOT NULL,\n\t`message_id` integer NOT NULL,\n\t`parent_id` integer,\n\t`source` text NOT NULL,\n\t`kind` text NOT NULL,\n\t`confidence` real NOT NULL,\n\t`method` text NOT NULL,\n\t`version` text,\n\t`batch` text,\n\t`build` integer,\n\t`created_at` integer NOT NULL,\n\t`stale_at` integer,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_message_links_chat_id_chats_id_fk` FOREIGN KEY (`chat_id`) REFERENCES `chats`(`id`) ON DELETE CASCADE,\n\tCONSTRAINT `fk_message_links_message_id_messages_id_fk` FOREIGN KEY (`message_id`) REFERENCES `messages`(`id`) ON DELETE CASCADE,\n\tCONSTRAINT `fk_message_links_parent_id_messages_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `messages`(`id`) ON DELETE CASCADE\n);",
|
|
1785
|
+
"INSERT INTO `__new_message_links`(`id`, `chat_id`, `message_id`, `parent_id`, `source`, `kind`, `confidence`, `method`, `version`, `batch`, `build`, `created_at`, `stale_at`, `updated_at`) SELECT `id`, `chat_id`, `message_id`, `parent_id`, `source`, `kind`, `confidence`, `method`, `version`, `batch`, `build`, `created_at`, `stale_at`, `updated_at` FROM `message_links`;",
|
|
1786
|
+
"DROP TABLE `message_links`;",
|
|
1787
|
+
"ALTER TABLE `__new_message_links` RENAME TO `message_links`;",
|
|
1788
|
+
"CREATE TABLE `__new_message_reactions` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`chat_id` integer NOT NULL,\n\t`message_external_id` text NOT NULL,\n\t`identity_id` integer NOT NULL,\n\t`own` integer NOT NULL,\n\t`reaction` text,\n\t`reacted_at` integer NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_message_reactions_chat_id_chats_id_fk` FOREIGN KEY (`chat_id`) REFERENCES `chats`(`id`),\n\tCONSTRAINT `fk_message_reactions_identity_id_identities_id_fk` FOREIGN KEY (`identity_id`) REFERENCES `identities`(`id`),\n\tCONSTRAINT `message_reactions_chat_id_message_external_id_identity_id_unique` UNIQUE(`chat_id`,`message_external_id`,`identity_id`)\n);",
|
|
1789
|
+
"INSERT INTO `__new_message_reactions`(`id`, `chat_id`, `message_external_id`, `identity_id`, `own`, `reaction`, `reacted_at`, `created_at`, `updated_at`) SELECT `id`, `chat_id`, `message_external_id`, `identity_id`, `own`, `reaction`, `reacted_at`, `created_at`, `updated_at` FROM `message_reactions`;",
|
|
1790
|
+
"DROP TABLE `message_reactions`;",
|
|
1791
|
+
"ALTER TABLE `__new_message_reactions` RENAME TO `message_reactions`;",
|
|
1792
|
+
"CREATE TABLE `__new_message_revisions` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`message_id` integer NOT NULL,\n\t`text` text NOT NULL,\n\t`edited_at` integer,\n\t`created_at` integer NOT NULL,\n\tCONSTRAINT `fk_message_revisions_message_id_messages_id_fk` FOREIGN KEY (`message_id`) REFERENCES `messages`(`id`)\n);",
|
|
1793
|
+
"INSERT INTO `__new_message_revisions`(`id`, `message_id`, `text`, `edited_at`, `created_at`) SELECT `id`, `message_id`, `text`, `edited_at`, `created_at` FROM `message_revisions`;",
|
|
1794
|
+
"DROP TABLE `message_revisions`;",
|
|
1795
|
+
"ALTER TABLE `__new_message_revisions` RENAME TO `message_revisions`;",
|
|
1796
|
+
"CREATE TABLE `__new_message_transcripts` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`message_id` integer,\n\t`chat_id` integer NOT NULL,\n\t`message_external_id` text NOT NULL,\n\t`text` text NOT NULL,\n\t`source` text NOT NULL,\n\t`heard_at` integer NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_message_transcripts_message_id_messages_id_fk` FOREIGN KEY (`message_id`) REFERENCES `messages`(`id`),\n\tCONSTRAINT `fk_message_transcripts_chat_id_chats_id_fk` FOREIGN KEY (`chat_id`) REFERENCES `chats`(`id`),\n\tCONSTRAINT `message_transcripts_chat_id_message_external_id_unique` UNIQUE(`chat_id`,`message_external_id`)\n);",
|
|
1797
|
+
"INSERT INTO `__new_message_transcripts`(`id`, `message_id`, `chat_id`, `message_external_id`, `text`, `source`, `heard_at`, `created_at`, `updated_at`) SELECT `id`, `message_id`, `chat_id`, `message_external_id`, `text`, `source`, `heard_at`, `created_at`, `updated_at` FROM `message_transcripts`;",
|
|
1798
|
+
"DROP TABLE `message_transcripts`;",
|
|
1799
|
+
"ALTER TABLE `__new_message_transcripts` RENAME TO `message_transcripts`;",
|
|
1800
|
+
"CREATE TABLE `__new_note_revisions` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`note_id` integer NOT NULL,\n\t`body` text NOT NULL,\n\t`revision` integer NOT NULL,\n\t`created_at` integer NOT NULL,\n\tCONSTRAINT `fk_note_revisions_note_id_notes_id_fk` FOREIGN KEY (`note_id`) REFERENCES `notes`(`id`)\n);",
|
|
1801
|
+
"INSERT INTO `__new_note_revisions`(`id`, `note_id`, `body`, `revision`, `created_at`) SELECT `id`, `note_id`, `body`, `revision`, `created_at` FROM `note_revisions`;",
|
|
1802
|
+
"DROP TABLE `note_revisions`;",
|
|
1803
|
+
"ALTER TABLE `__new_note_revisions` RENAME TO `note_revisions`;",
|
|
1804
|
+
"CREATE TABLE `__new_organization_identities` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`identity_id` integer NOT NULL,\n\t`organization_id` integer NOT NULL,\n\t`method` text NOT NULL,\n\t`author` text NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_organization_identities_identity_id_identities_id_fk` FOREIGN KEY (`identity_id`) REFERENCES `identities`(`id`),\n\tCONSTRAINT `fk_organization_identities_organization_id_organizations_id_fk` FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`),\n\tCONSTRAINT `organization_identities_identity_id_organization_id_unique` UNIQUE(`identity_id`,`organization_id`)\n);",
|
|
1805
|
+
"INSERT INTO `__new_organization_identities`(`id`, `identity_id`, `organization_id`, `method`, `author`, `created_at`, `updated_at`) SELECT `id`, `identity_id`, `organization_id`, `method`, `author`, `created_at`, `updated_at` FROM `organization_identities`;",
|
|
1806
|
+
"DROP TABLE `organization_identities`;",
|
|
1807
|
+
"ALTER TABLE `__new_organization_identities` RENAME TO `organization_identities`;",
|
|
1808
|
+
"CREATE TABLE `__new_payment_allocations` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`payment_id` integer NOT NULL,\n\t`invoice_id` integer NOT NULL,\n\t`amount` integer NOT NULL,\n\t`author_type` text NOT NULL,\n\t`author_id` integer NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_payment_allocations_payment_id_payments_id_fk` FOREIGN KEY (`payment_id`) REFERENCES `payments`(`id`),\n\tCONSTRAINT `fk_payment_allocations_invoice_id_invoices_id_fk` FOREIGN KEY (`invoice_id`) REFERENCES `invoices`(`id`),\n\tCONSTRAINT `payment_allocations_payment_id_invoice_id_unique` UNIQUE(`payment_id`,`invoice_id`)\n);",
|
|
1809
|
+
"INSERT INTO `__new_payment_allocations`(`id`, `payment_id`, `invoice_id`, `amount`, `author_type`, `author_id`, `created_at`, `updated_at`) SELECT `id`, `payment_id`, `invoice_id`, `amount`, `author_type`, `author_id`, `created_at`, `updated_at` FROM `payment_allocations`;",
|
|
1810
|
+
"DROP TABLE `payment_allocations`;",
|
|
1811
|
+
"ALTER TABLE `__new_payment_allocations` RENAME TO `payment_allocations`;",
|
|
1812
|
+
"CREATE TABLE `__new_persons` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`name` text,\n\t`owner` integer DEFAULT 0 NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`kind` text,\n\t`name_order` text,\n\t`messages_from` integer,\n\t`task_count` integer,\n\t`last_contact` integer\n);",
|
|
1813
|
+
"INSERT INTO `__new_persons`(`id`, `name`, `owner`, `created_at`, `updated_at`, `kind`, `name_order`, `messages_from`, `task_count`, `last_contact`) SELECT `id`, `name`, `owner`, `created_at`, `updated_at`, `kind`, `name_order`, `messages_from`, `task_count`, `last_contact` FROM `persons`;",
|
|
1814
|
+
"DROP TABLE `persons`;",
|
|
1815
|
+
"ALTER TABLE `__new_persons` RENAME TO `persons`;",
|
|
1816
|
+
"CREATE TABLE `__new_pipeline_stage_changes` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`item_type` text NOT NULL,\n\t`item_id` integer NOT NULL,\n\t`pipeline_id` integer NOT NULL,\n\t`from_stage_id` integer,\n\t`to_stage_id` integer NOT NULL,\n\t`changed_at` integer NOT NULL,\n\tCONSTRAINT `fk_pipeline_stage_changes_pipeline_id_pipelines_id_fk` FOREIGN KEY (`pipeline_id`) REFERENCES `pipelines`(`id`),\n\tCONSTRAINT `fk_pipeline_stage_changes_from_stage_id_pipeline_stages_id_fk` FOREIGN KEY (`from_stage_id`) REFERENCES `pipeline_stages`(`id`),\n\tCONSTRAINT `fk_pipeline_stage_changes_to_stage_id_pipeline_stages_id_fk` FOREIGN KEY (`to_stage_id`) REFERENCES `pipeline_stages`(`id`)\n);",
|
|
1817
|
+
"INSERT INTO `__new_pipeline_stage_changes`(`id`, `item_type`, `item_id`, `pipeline_id`, `from_stage_id`, `to_stage_id`, `changed_at`) SELECT `id`, `item_type`, `item_id`, `pipeline_id`, `from_stage_id`, `to_stage_id`, `changed_at` FROM `pipeline_stage_changes`;",
|
|
1818
|
+
"DROP TABLE `pipeline_stage_changes`;",
|
|
1819
|
+
"ALTER TABLE `__new_pipeline_stage_changes` RENAME TO `pipeline_stage_changes`;",
|
|
1820
|
+
"CREATE TABLE `__new_pipeline_stages` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`pipeline_id` integer NOT NULL,\n\t`name` text NOT NULL,\n\t`name_folded` text NOT NULL,\n\t`position` integer NOT NULL,\n\t`outcome` text DEFAULT 'open' NOT NULL,\n\t`external_id` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\t`base_stage_id` integer,\n\t`base_confirmed` integer DEFAULT 0 NOT NULL,\n\tCONSTRAINT `fk_pipeline_stages_pipeline_id_pipelines_id_fk` FOREIGN KEY (`pipeline_id`) REFERENCES `pipelines`(`id`),\n\tCONSTRAINT `fk_pipeline_stages_base_stage_id_pipeline_stages_id_fk` FOREIGN KEY (`base_stage_id`) REFERENCES `pipeline_stages`(`id`),\n\tCONSTRAINT `pipeline_stages_pipeline_id_name_folded_unique` UNIQUE(`pipeline_id`,`name_folded`)\n);",
|
|
1821
|
+
"INSERT INTO `__new_pipeline_stages`(`id`, `pipeline_id`, `name`, `name_folded`, `position`, `outcome`, `external_id`, `created_at`, `updated_at`, `deleted_at`, `base_stage_id`, `base_confirmed`) SELECT `id`, `pipeline_id`, `name`, `name_folded`, `position`, `outcome`, `external_id`, `created_at`, `updated_at`, `deleted_at`, `base_stage_id`, `base_confirmed` FROM `pipeline_stages`;",
|
|
1822
|
+
"DROP TABLE `pipeline_stages`;",
|
|
1823
|
+
"ALTER TABLE `__new_pipeline_stages` RENAME TO `pipeline_stages`;",
|
|
1824
|
+
"CREATE TABLE `__new_pipelines` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`account_id` integer,\n\t`external_id` text,\n\t`kind` text DEFAULT 'deal' NOT NULL,\n\t`name` text NOT NULL,\n\t`name_folded` text NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`deleted_at` integer,\n\tCONSTRAINT `fk_pipelines_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`)\n);",
|
|
1825
|
+
"INSERT INTO `__new_pipelines`(`id`, `account_id`, `external_id`, `kind`, `name`, `name_folded`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `account_id`, `external_id`, `kind`, `name`, `name_folded`, `created_at`, `updated_at`, `deleted_at` FROM `pipelines`;",
|
|
1826
|
+
"DROP TABLE `pipelines`;",
|
|
1827
|
+
"ALTER TABLE `__new_pipelines` RENAME TO `pipelines`;",
|
|
1828
|
+
"CREATE TABLE `__new_places` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`address` text NOT NULL,\n\t`folded` text NOT NULL UNIQUE,\n\t`author` text NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL\n);",
|
|
1829
|
+
"INSERT INTO `__new_places`(`id`, `address`, `folded`, `author`, `created_at`, `updated_at`) SELECT `id`, `address`, `folded`, `author`, `created_at`, `updated_at` FROM `places`;",
|
|
1830
|
+
"DROP TABLE `places`;",
|
|
1831
|
+
"ALTER TABLE `__new_places` RENAME TO `places`;",
|
|
1832
|
+
"CREATE TABLE `__new_record_relations` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`record_id` integer NOT NULL,\n\t`role` text NOT NULL,\n\t`target_type` text NOT NULL,\n\t`target_external_id` text NOT NULL,\n\t`target_id` integer,\n\t`created_at` integer NOT NULL,\n\t`amount` text,\n\t`as_role` text,\n\tCONSTRAINT `fk_record_relations_record_id_records_id_fk` FOREIGN KEY (`record_id`) REFERENCES `records`(`id`),\n\tCONSTRAINT `fk_record_relations_target_id_records_id_fk` FOREIGN KEY (`target_id`) REFERENCES `records`(`id`),\n\tCONSTRAINT `record_relations_record_id_role_target_type_target_external_id_unique` UNIQUE(`record_id`,`role`,`target_type`,`target_external_id`)\n);",
|
|
1833
|
+
"INSERT INTO `__new_record_relations`(`id`, `record_id`, `role`, `target_type`, `target_external_id`, `target_id`, `created_at`, `amount`, `as_role`) SELECT `id`, `record_id`, `role`, `target_type`, `target_external_id`, `target_id`, `created_at`, `amount`, `as_role` FROM `record_relations`;",
|
|
1834
|
+
"DROP TABLE `record_relations`;",
|
|
1835
|
+
"ALTER TABLE `__new_record_relations` RENAME TO `record_relations`;",
|
|
1836
|
+
"CREATE TABLE `__new_reminders` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`task_id` integer NOT NULL,\n\t`account_id` integer NOT NULL,\n\t`due_at` integer NOT NULL,\n\t`timezone` text NOT NULL,\n\t`state` text NOT NULL,\n\t`revision` integer DEFAULT 1 NOT NULL,\n\t`lease_until` integer,\n\t`receipt` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_reminders_task_id_tasks_id_fk` FOREIGN KEY (`task_id`) REFERENCES `tasks`(`id`),\n\tCONSTRAINT `fk_reminders_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`)\n);",
|
|
1837
|
+
"INSERT INTO `__new_reminders`(`id`, `task_id`, `account_id`, `due_at`, `timezone`, `state`, `revision`, `lease_until`, `receipt`, `created_at`, `updated_at`) SELECT `id`, `task_id`, `account_id`, `due_at`, `timezone`, `state`, `revision`, `lease_until`, `receipt`, `created_at`, `updated_at` FROM `reminders`;",
|
|
1838
|
+
"DROP TABLE `reminders`;",
|
|
1839
|
+
"ALTER TABLE `__new_reminders` RENAME TO `reminders`;",
|
|
1840
|
+
"CREATE TABLE `__new_task_assignments` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`task_id` integer NOT NULL,\n\t`assignee_type` text NOT NULL,\n\t`assignee_id` integer NOT NULL,\n\t`role` text NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_task_assignments_task_id_tasks_id_fk` FOREIGN KEY (`task_id`) REFERENCES `tasks`(`id`),\n\tCONSTRAINT `task_assignments_task_id_assignee_type_assignee_id_role_unique` UNIQUE(`task_id`,`assignee_type`,`assignee_id`,`role`)\n);",
|
|
1841
|
+
"INSERT INTO `__new_task_assignments`(`id`, `task_id`, `assignee_type`, `assignee_id`, `role`, `created_at`, `updated_at`) SELECT `id`, `task_id`, `assignee_type`, `assignee_id`, `role`, `created_at`, `updated_at` FROM `task_assignments`;",
|
|
1842
|
+
"DROP TABLE `task_assignments`;",
|
|
1843
|
+
"ALTER TABLE `__new_task_assignments` RENAME TO `task_assignments`;",
|
|
1844
|
+
"CREATE TABLE `__new_templates_history` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`key` text NOT NULL,\n\t`channel` text NOT NULL,\n\t`language` text NOT NULL,\n\t`body` text NOT NULL,\n\t`saved_at` integer NOT NULL,\n\t`saved_by` text NOT NULL,\n\t`replaced_at` integer NOT NULL\n);",
|
|
1845
|
+
"INSERT INTO `__new_templates_history`(`id`, `key`, `channel`, `language`, `body`, `saved_at`, `saved_by`, `replaced_at`) SELECT `id`, `key`, `channel`, `language`, `body`, `saved_at`, `saved_by`, `replaced_at` FROM `templates_history`;",
|
|
1846
|
+
"DROP TABLE `templates_history`;",
|
|
1847
|
+
"ALTER TABLE `__new_templates_history` RENAME TO `templates_history`;",
|
|
1848
|
+
"CREATE TABLE `__new_transaction_splits` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT,\n\t`transaction_id` integer NOT NULL,\n\t`position` integer NOT NULL,\n\t`category` text NOT NULL,\n\t`category_folded` text NOT NULL,\n\t`amount` integer NOT NULL,\n\t`project_id` integer,\n\t`note` text,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\tCONSTRAINT `fk_transaction_splits_transaction_id_financial_transactions_id_fk` FOREIGN KEY (`transaction_id`) REFERENCES `financial_transactions`(`id`),\n\tCONSTRAINT `fk_transaction_splits_project_id_projects_id_fk` FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`),\n\tCONSTRAINT `transaction_splits_transaction_id_position_unique` UNIQUE(`transaction_id`,`position`)\n);",
|
|
1849
|
+
"INSERT INTO `__new_transaction_splits`(`id`, `transaction_id`, `position`, `category`, `category_folded`, `amount`, `project_id`, `note`, `created_at`, `updated_at`) SELECT `id`, `transaction_id`, `position`, `category`, `category_folded`, `amount`, `project_id`, `note`, `created_at`, `updated_at` FROM `transaction_splits`;",
|
|
1850
|
+
"DROP TABLE `transaction_splits`;",
|
|
1851
|
+
"ALTER TABLE `__new_transaction_splits` RENAME TO `transaction_splits`;",
|
|
1852
|
+
"CREATE INDEX `accounts_by_organization_id` ON `accounts` (`organization_id`);",
|
|
1853
|
+
"CREATE INDEX `agent_actions_by_started_at_desc` ON `agent_actions` (\"started_at\" desc);",
|
|
1854
|
+
"CREATE INDEX `agent_actions_by_actor_type_actor_id` ON `agent_actions` (`actor_type`,`actor_id`);",
|
|
1855
|
+
"CREATE INDEX `agent_actions_by_target_type_target_id` ON `agent_actions` (`target_type`,`target_id`);",
|
|
1856
|
+
"CREATE INDEX `attachments_by_name_folded` ON `attachments` (`name_folded`);",
|
|
1857
|
+
"CREATE INDEX `attachments_local_path_to_fold` ON `attachments` (`id`) WHERE local_path IS NOT NULL AND local_path_folded IS NULL;",
|
|
1858
|
+
"CREATE INDEX `bot_updates_by_account_id_received_at_desc` ON `bot_updates` (`account_id`,\"received_at\" desc);",
|
|
1859
|
+
"CREATE INDEX `bots_by_owner_person_id` ON `bots` (`owner_person_id`);",
|
|
1860
|
+
"CREATE INDEX `calendar_entries_by_calendar_id_starts_at` ON `calendar_entries` (`calendar_id`,`starts_at`);",
|
|
1861
|
+
"CREATE INDEX `calendar_entries_by_ical_uid` ON `calendar_entries` (`ical_uid`) WHERE ical_uid IS NOT NULL;",
|
|
1862
|
+
"CREATE INDEX `calendar_entries_by_join_key` ON `calendar_entries` (`join_key`) WHERE join_key IS NOT NULL;",
|
|
1863
|
+
"CREATE INDEX `calendar_entries_by_calendar_id_series_external_id` ON `calendar_entries` (`calendar_id`,`series_external_id`) WHERE series_external_id IS NOT NULL;",
|
|
1864
|
+
"CREATE INDEX `calendar_entries_by_event_id` ON `calendar_entries` (`event_id`);",
|
|
1865
|
+
"CREATE INDEX `calendar_entries_by_event_series_id` ON `calendar_entries` (`event_series_id`);",
|
|
1866
|
+
"CREATE INDEX `calendar_entries_by_event_type_event_id` ON `calendar_entries` (`event_type`,`event_id`);",
|
|
1867
|
+
"CREATE INDEX `calendar_entries_by_organizer_identity_id` ON `calendar_entries` (`organizer_identity_id`);",
|
|
1868
|
+
"CREATE UNIQUE INDEX `catalog_items_by_supplier_type_supplier_id_sku` ON `catalog_items` (`supplier_type`,`supplier_id`,`sku`) WHERE supplier_id IS NOT NULL AND sku IS NOT NULL AND deleted_at IS NULL;",
|
|
1869
|
+
"CREATE UNIQUE INDEX `catalog_items_by_sku` ON `catalog_items` (`sku`) WHERE supplier_id IS NULL AND sku IS NOT NULL AND deleted_at IS NULL;",
|
|
1870
|
+
"CREATE INDEX `catalog_items_by_name_folded` ON `catalog_items` (`name_folded`);",
|
|
1871
|
+
"CREATE INDEX `catalog_items_by_author_type_author_id` ON `catalog_items` (`author_type`,`author_id`);",
|
|
1872
|
+
"CREATE INDEX `chats_by_recency` ON `chats` (`account_id`,\"last_message_at\" desc);",
|
|
1873
|
+
"CREATE INDEX `chats_title_to_fold` ON `chats` (`id`) WHERE title IS NOT NULL AND title_folded IS NULL;",
|
|
1874
|
+
"CREATE INDEX `chats_by_parent_chat_id` ON `chats` (`parent_chat_id`);",
|
|
1875
|
+
"CREATE INDEX `content_metrics_by_post_id_at` ON `content_metrics` (`post_id`,`at`);",
|
|
1876
|
+
"CREATE INDEX `content_posts_by_account_id_status` ON `content_posts` (`account_id`,`status`);",
|
|
1877
|
+
"CREATE INDEX `content_posts_by_account_id_published_at` ON `content_posts` (`account_id`,`published_at`);",
|
|
1878
|
+
"CREATE INDEX `content_terms_by_tag_id` ON `content_terms` (`tag_id`);",
|
|
1879
|
+
"CREATE INDEX `contracts_by_project_id` ON `contracts` (`project_id`);",
|
|
1880
|
+
"CREATE INDEX `contracts_by_deal_id` ON `contracts` (`deal_id`);",
|
|
1881
|
+
"CREATE INDEX `contracts_by_author_type_author_id` ON `contracts` (`author_type`,`author_id`);",
|
|
1882
|
+
"CREATE INDEX `contracts_by_confirmed_by_type_confirmed_by_id` ON `contracts` (`confirmed_by_type`,`confirmed_by_id`);",
|
|
1883
|
+
"CREATE UNIQUE INDEX `deals_by_account_id_external_id` ON `deals` (`account_id`,`external_id`) WHERE account_id IS NOT NULL AND external_id IS NOT NULL;",
|
|
1884
|
+
"CREATE INDEX `deals_by_organization_id` ON `deals` (`organization_id`);",
|
|
1885
|
+
"CREATE INDEX `deals_by_project_id` ON `deals` (`project_id`);",
|
|
1886
|
+
"CREATE INDEX `deals_by_stage_id` ON `deals` (`stage_id`);",
|
|
1887
|
+
"CREATE INDEX `deals_by_author_type_author_id` ON `deals` (`author_type`,`author_id`);",
|
|
1888
|
+
"CREATE INDEX `decisions_by_project_id` ON `decisions` (`project_id`);",
|
|
1889
|
+
"CREATE INDEX `decisions_by_supersedes_id` ON `decisions` (`supersedes_id`);",
|
|
1890
|
+
"CREATE INDEX `decisions_by_confirmed_by_type_confirmed_by_id` ON `decisions` (`confirmed_by_type`,`confirmed_by_id`);",
|
|
1891
|
+
"CREATE INDEX `document_revisions_by_document_id` ON `document_revisions` (`document_id`);",
|
|
1892
|
+
"CREATE INDEX `email_threads_subject_to_fold` ON `email_threads` (`id`) WHERE subject IS NOT NULL AND subject_folded IS NULL;",
|
|
1893
|
+
"CREATE INDEX `emails_by_time` ON `emails` (`account_id`,\"sent_at\" desc);",
|
|
1894
|
+
"CREATE INDEX `emails_by_mail_rule_id` ON `emails` (`mail_rule_id`) WHERE mail_rule_id IS NOT NULL;",
|
|
1895
|
+
"CREATE INDEX `emails_by_email_thread_id` ON `emails` (`email_thread_id`);",
|
|
1896
|
+
"CREATE INDEX `emails_by_from_identity_id` ON `emails` (`from_identity_id`);",
|
|
1897
|
+
"CREATE INDEX `facts_by_project_id` ON `facts` (`project_id`);",
|
|
1898
|
+
"CREATE INDEX `facts_by_subject_type_subject_id` ON `facts` (`subject_type`,`subject_id`);",
|
|
1899
|
+
"CREATE INDEX `facts_by_supersedes_id` ON `facts` (`supersedes_id`);",
|
|
1900
|
+
"CREATE INDEX `facts_by_author_type_author_id` ON `facts` (`author_type`,`author_id`);",
|
|
1901
|
+
"CREATE INDEX `facts_by_confirmed_by_type_confirmed_by_id` ON `facts` (`confirmed_by_type`,`confirmed_by_id`);",
|
|
1902
|
+
"CREATE INDEX `files_by_account_id_path_folded` ON `files` (`account_id`,`path_folded`);",
|
|
1903
|
+
"CREATE INDEX `files_path_to_fold` ON `files` (`id`) WHERE path_folded IS NULL;",
|
|
1904
|
+
"CREATE INDEX `files_by_parent_id` ON `files` (`parent_id`);",
|
|
1905
|
+
"CREATE INDEX `files_by_document_id` ON `files` (`document_id`);",
|
|
1906
|
+
"CREATE INDEX `financial_accounts_by_name_folded` ON `financial_accounts` (`name_folded`);",
|
|
1907
|
+
"CREATE INDEX `financial_accounts_by_holder_type_holder_id` ON `financial_accounts` (`holder_type`,`holder_id`);",
|
|
1908
|
+
"CREATE INDEX `financial_accounts_by_author_type_author_id` ON `financial_accounts` (`author_type`,`author_id`);",
|
|
1909
|
+
"CREATE INDEX `financial_transactions_by_financial_account_id_booked_date` ON `financial_transactions` (`financial_account_id`,`booked_date`);",
|
|
1910
|
+
"CREATE UNIQUE INDEX `financial_transactions_by_payment_id` ON `financial_transactions` (`payment_id`) WHERE payment_id IS NOT NULL AND deleted_at IS NULL;",
|
|
1911
|
+
"CREATE INDEX `financial_transactions_by_counterparty_type_counterparty_id` ON `financial_transactions` (`counterparty_type`,`counterparty_id`);",
|
|
1912
|
+
"CREATE INDEX `financial_transactions_by_project_id` ON `financial_transactions` (`project_id`);",
|
|
1913
|
+
"CREATE INDEX `financial_transactions_by_author_type_author_id` ON `financial_transactions` (`author_type`,`author_id`);",
|
|
1914
|
+
"CREATE INDEX `financial_transactions_by_confirmed_by_type_confirmed_by_id` ON `financial_transactions` (`confirmed_by_type`,`confirmed_by_id`);",
|
|
1915
|
+
"CREATE INDEX `identities_by_email` ON `identities` (`email`) WHERE email IS NOT NULL;",
|
|
1916
|
+
"CREATE INDEX `identities_name_to_fold` ON `identities` (`id`) WHERE name IS NOT NULL AND name_folded IS NULL;",
|
|
1917
|
+
"CREATE INDEX `identity_revisions_by_identity` ON `identity_revisions` (`identity_id`,`created_at`);",
|
|
1918
|
+
"CREATE INDEX `invoice_lines_by_catalog_item_id` ON `invoice_lines` (`catalog_item_id`);",
|
|
1919
|
+
"CREATE INDEX `invoices_by_issuer_type_issuer_id` ON `invoices` (`issuer_type`,`issuer_id`);",
|
|
1920
|
+
"CREATE INDEX `invoices_by_counterparty_type_counterparty_id` ON `invoices` (`counterparty_type`,`counterparty_id`);",
|
|
1921
|
+
"CREATE INDEX `invoices_by_project_id` ON `invoices` (`project_id`);",
|
|
1922
|
+
"CREATE INDEX `invoices_by_author_type_author_id` ON `invoices` (`author_type`,`author_id`);",
|
|
1923
|
+
"CREATE INDEX `invoices_by_confirmed_by_type_confirmed_by_id` ON `invoices` (`confirmed_by_type`,`confirmed_by_id`);",
|
|
1924
|
+
"CREATE INDEX `invoices_by_contract_id` ON `invoices` (`contract_id`);",
|
|
1925
|
+
"CREATE INDEX `invoices_by_subscription_id` ON `invoices` (`subscription_id`);",
|
|
1926
|
+
"CREATE UNIQUE INDEX `leads_by_account_id_external_id` ON `leads` (`account_id`,`external_id`) WHERE account_id IS NOT NULL AND external_id IS NOT NULL;",
|
|
1927
|
+
"CREATE INDEX `leads_by_organization_id` ON `leads` (`organization_id`);",
|
|
1928
|
+
"CREATE INDEX `leads_by_project_id` ON `leads` (`project_id`);",
|
|
1929
|
+
"CREATE INDEX `leads_by_stage_id` ON `leads` (`stage_id`);",
|
|
1930
|
+
"CREATE INDEX `leads_by_deal_id` ON `leads` (`deal_id`);",
|
|
1931
|
+
"CREATE INDEX `leads_by_author_type_author_id` ON `leads` (`author_type`,`author_id`);",
|
|
1932
|
+
"CREATE INDEX `link_reviews_by_status_created_at` ON `link_reviews` (`status`,`created_at`);",
|
|
1933
|
+
"CREATE INDEX `link_revisions_by_link_id_created_at` ON `link_revisions` (`link_id`,`created_at`);",
|
|
1934
|
+
"CREATE INDEX `links_unresolved` ON `links` (`target_folded`) WHERE to_id IS NULL;",
|
|
1935
|
+
"CREATE UNIQUE INDEX `links_relationship_key` ON `links` (`kind`,`from_type`,`from_id`,`to_type`,`to_id`,ifnull(\"anchor\", ''),ifnull(\"role\", ''),ifnull(\"account_id\", 0)) WHERE kind IN ('member-of', 'related-to', 'reports-to', 'customer-of', 'partner-of') AND to_id IS NOT NULL;",
|
|
1936
|
+
"CREATE INDEX `links_by_from_type_from_id` ON `links` (`from_type`,`from_id`);",
|
|
1937
|
+
"CREATE INDEX `links_by_to_type_to_id` ON `links` (`to_type`,`to_id`);",
|
|
1938
|
+
"CREATE UNIQUE INDEX `meeting_chat_messages_by_meeting_id_external_id` ON `meeting_chat_messages` (`meeting_id`,`external_id`) WHERE external_id IS NOT NULL;",
|
|
1939
|
+
"CREATE INDEX `meeting_chat_messages_by_meeting_id` ON `meeting_chat_messages` (`meeting_id`);",
|
|
1940
|
+
"CREATE INDEX `meeting_chat_messages_by_sender_participant_id` ON `meeting_chat_messages` (`sender_participant_id`);",
|
|
1941
|
+
"CREATE INDEX `meeting_participants_by_identity_id` ON `meeting_participants` (`identity_id`);",
|
|
1942
|
+
"CREATE INDEX `meeting_series_by_event_series_id` ON `meeting_series` (`event_series_id`);",
|
|
1943
|
+
"CREATE INDEX `meeting_series_by_host_identity_id` ON `meeting_series` (`host_identity_id`);",
|
|
1944
|
+
"CREATE INDEX `meeting_transcript_rows_by_speaker_participant_id` ON `meeting_transcript_rows` (`speaker_participant_id`);",
|
|
1945
|
+
"CREATE INDEX `meeting_transcripts_by_meeting_id` ON `meeting_transcripts` (`meeting_id`);",
|
|
1946
|
+
"CREATE INDEX `meetings_by_join_key` ON `meetings` (`join_key`) WHERE join_key IS NOT NULL;",
|
|
1947
|
+
"CREATE INDEX `meetings_join_key_to_fill` ON `meetings` (`id`) WHERE join_url IS NOT NULL AND join_key IS NULL;",
|
|
1948
|
+
"CREATE INDEX `meetings_by_time` ON `meetings` (`account_id`,\"started_at\" desc);",
|
|
1949
|
+
"CREATE INDEX `meetings_by_account_id_title_folded` ON `meetings` (`account_id`,`title_folded`);",
|
|
1950
|
+
"CREATE INDEX `meetings_title_to_fold` ON `meetings` (`id`) WHERE title IS NOT NULL AND title_folded IS NULL;",
|
|
1951
|
+
"CREATE INDEX `meetings_by_meeting_series_id` ON `meetings` (`meeting_series_id`);",
|
|
1952
|
+
"CREATE INDEX `meetings_by_event_id` ON `meetings` (`event_id`);",
|
|
1953
|
+
"CREATE INDEX `meetings_by_host_identity_id` ON `meetings` (`host_identity_id`);",
|
|
1954
|
+
"CREATE INDEX `memories_by_subject_type_subject_id` ON `memories` (`subject_type`,`subject_id`);",
|
|
1955
|
+
"CREATE INDEX `memories_by_author_type_author_id` ON `memories` (`author_type`,`author_id`);",
|
|
1956
|
+
"CREATE INDEX `memories_by_supersedes_id` ON `memories` (`supersedes_id`);",
|
|
1957
|
+
"CREATE INDEX `memories_by_project_id` ON `memories` (`project_id`);",
|
|
1958
|
+
"CREATE INDEX `messages_by_time` ON `messages` (`chat_id`,\"sent_at\" desc);",
|
|
1959
|
+
"CREATE INDEX `messages_starred_by_time` ON `messages` (`chat_id`,\"sent_at\" desc) WHERE starred = 1;",
|
|
1960
|
+
"CREATE INDEX `messages_by_reply` ON `messages` (`chat_id`,`reply_to_external_id`) WHERE reply_to_external_id IS NOT NULL AND deleted_at IS NULL;",
|
|
1961
|
+
"CREATE INDEX `messages_by_account` ON `messages` (`account_id`,`external_id`);",
|
|
1962
|
+
"CREATE INDEX `messages_to_normalize` ON `messages` (`id`) WHERE normalized_text IS NULL AND deleted_at IS NULL;",
|
|
1963
|
+
"CREATE INDEX `messages_by_sender_identity_id` ON `messages` (`sender_identity_id`);",
|
|
1964
|
+
"CREATE INDEX `messages_by_thread_root_id` ON `messages` (`thread_root_id`);",
|
|
1965
|
+
"CREATE INDEX `messages_by_chat_id_thread_external_id` ON `messages` (`chat_id`,`thread_external_id`) WHERE thread_root_id IS NULL AND thread_external_id IS NOT NULL;",
|
|
1966
|
+
"CREATE INDEX `notes_by_notable_type_notable_id` ON `notes` (`notable_type`,`notable_id`);",
|
|
1967
|
+
"CREATE INDEX `notes_by_author_type_author_id` ON `notes` (`author_type`,`author_id`);",
|
|
1968
|
+
"CREATE INDEX `order_lines_by_catalog_item_id` ON `order_lines` (`catalog_item_id`);",
|
|
1969
|
+
"CREATE INDEX `orders_by_customer_type_customer_id` ON `orders` (`customer_type`,`customer_id`);",
|
|
1970
|
+
"CREATE INDEX `orders_by_supplier_type_supplier_id` ON `orders` (`supplier_type`,`supplier_id`);",
|
|
1971
|
+
"CREATE INDEX `orders_by_invoice_id` ON `orders` (`invoice_id`);",
|
|
1972
|
+
"CREATE INDEX `orders_by_payment_id` ON `orders` (`payment_id`);",
|
|
1973
|
+
"CREATE INDEX `orders_by_project_id` ON `orders` (`project_id`);",
|
|
1974
|
+
"CREATE INDEX `orders_by_author_type_author_id` ON `orders` (`author_type`,`author_id`);",
|
|
1975
|
+
"CREATE INDEX `orders_by_confirmed_by_type_confirmed_by_id` ON `orders` (`confirmed_by_type`,`confirmed_by_id`);",
|
|
1976
|
+
"CREATE INDEX `orders_by_contract_id` ON `orders` (`contract_id`);",
|
|
1977
|
+
"CREATE INDEX `orders_by_deal_id` ON `orders` (`deal_id`);",
|
|
1978
|
+
"CREATE INDEX `payments_by_payer_type_payer_id` ON `payments` (`payer_type`,`payer_id`);",
|
|
1979
|
+
"CREATE INDEX `payments_by_payee_type_payee_id` ON `payments` (`payee_type`,`payee_id`);",
|
|
1980
|
+
"CREATE INDEX `payments_by_project_id` ON `payments` (`project_id`);",
|
|
1981
|
+
"CREATE INDEX `payments_by_author_type_author_id` ON `payments` (`author_type`,`author_id`);",
|
|
1982
|
+
"CREATE INDEX `payments_by_confirmed_by_type_confirmed_by_id` ON `payments` (`confirmed_by_type`,`confirmed_by_id`);",
|
|
1983
|
+
"CREATE INDEX `payments_by_refund_of` ON `payments` (`refund_of`);",
|
|
1984
|
+
"CREATE INDEX `payments_by_subscription_id` ON `payments` (`subscription_id`);",
|
|
1985
|
+
"CREATE INDEX `poll_votes_by_identity_id` ON `poll_votes` (`identity_id`);",
|
|
1986
|
+
"CREATE INDEX `projects_by_name_folded` ON `projects` (`name_folded`);",
|
|
1987
|
+
"CREATE INDEX `projects_name_to_fold` ON `projects` (`id`) WHERE name_folded IS NULL;",
|
|
1988
|
+
"CREATE INDEX `projects_by_organization_id` ON `projects` (`organization_id`);",
|
|
1989
|
+
"CREATE INDEX `projects_by_account_id` ON `projects` (`account_id`);",
|
|
1990
|
+
"CREATE INDEX `projects_by_owner_type_owner_id` ON `projects` (`owner_type`,`owner_id`);",
|
|
1991
|
+
"CREATE INDEX `proposed_actions_by_status_created_at` ON `proposed_actions` (`status`,`created_at`);",
|
|
1992
|
+
"CREATE INDEX `proposed_actions_by_account_id` ON `proposed_actions` (`account_id`);",
|
|
1993
|
+
"CREATE INDEX `proposed_actions_by_target_type_target_id` ON `proposed_actions` (`target_type`,`target_id`);",
|
|
1994
|
+
"CREATE INDEX `proposed_actions_by_proposed_by_type_proposed_by_id` ON `proposed_actions` (`proposed_by_type`,`proposed_by_id`);",
|
|
1995
|
+
"CREATE INDEX `proposed_actions_by_decided_by_type_decided_by_id` ON `proposed_actions` (`decided_by_type`,`decided_by_id`);",
|
|
1996
|
+
"CREATE INDEX `records_by_account_id_batch_id` ON `records` (`account_id`,`batch_id`);",
|
|
1997
|
+
"CREATE INDEX `records_by_entity_type_entity_id` ON `records` (`entity_type`,`entity_id`);",
|
|
1998
|
+
"CREATE UNIQUE INDEX `searches_history` ON `searches` (`command`,`params`) WHERE name IS NULL;",
|
|
1999
|
+
"CREATE INDEX `searches_by_last_run` ON `searches` (\"last_run_at\" desc);",
|
|
2000
|
+
"CREATE UNIQUE INDEX `subscription_prices_by_subscription_id_effective_from` ON `subscription_prices` (`subscription_id`,`effective_from`) WHERE review <> 'rejected';",
|
|
2001
|
+
"CREATE INDEX `subscription_prices_by_author_type_author_id` ON `subscription_prices` (`author_type`,`author_id`);",
|
|
2002
|
+
"CREATE INDEX `subscription_prices_by_confirmed_by_type_confirmed_by_id` ON `subscription_prices` (`confirmed_by_type`,`confirmed_by_id`);",
|
|
2003
|
+
"CREATE INDEX `subscriptions_by_supplier_type_supplier_id` ON `subscriptions` (`supplier_type`,`supplier_id`);",
|
|
2004
|
+
"CREATE INDEX `subscriptions_by_customer_type_customer_id` ON `subscriptions` (`customer_type`,`customer_id`);",
|
|
2005
|
+
"CREATE INDEX `subscriptions_by_catalog_item_id` ON `subscriptions` (`catalog_item_id`);",
|
|
2006
|
+
"CREATE INDEX `subscriptions_by_contract_id` ON `subscriptions` (`contract_id`);",
|
|
2007
|
+
"CREATE INDEX `subscriptions_by_project_id` ON `subscriptions` (`project_id`);",
|
|
2008
|
+
"CREATE INDEX `subscriptions_by_author_type_author_id` ON `subscriptions` (`author_type`,`author_id`);",
|
|
2009
|
+
"CREATE INDEX `subscriptions_by_confirmed_by_type_confirmed_by_id` ON `subscriptions` (`confirmed_by_type`,`confirmed_by_id`);",
|
|
2010
|
+
"CREATE INDEX `syncs_by_account_id` ON `syncs` (`account_id`);",
|
|
2011
|
+
"CREATE INDEX `tag_consolidations_by_source_id` ON `tag_consolidations` (`source_id`);",
|
|
2012
|
+
"CREATE INDEX `tag_consolidations_by_survivor_id` ON `tag_consolidations` (`survivor_id`);",
|
|
2013
|
+
"CREATE INDEX `tag_consolidations_by_actor_type_actor_id` ON `tag_consolidations` (`actor_type`,`actor_id`);",
|
|
2014
|
+
"CREATE UNIQUE INDEX `taggings_main_topic` ON `taggings` (`taggable_type`,`taggable_id`) WHERE main = 1;",
|
|
2015
|
+
"CREATE INDEX `taggings_by_taggable_type_taggable_id` ON `taggings` (`taggable_type`,`taggable_id`);",
|
|
2016
|
+
"CREATE INDEX `taggings_by_author_type_author_id` ON `taggings` (`author_type`,`author_id`);",
|
|
2017
|
+
"CREATE INDEX `task_events_by_task_id` ON `task_events` (`task_id`);",
|
|
2018
|
+
"CREATE INDEX `task_events_by_actor_type_actor_id` ON `task_events` (`actor_type`,`actor_id`);",
|
|
2019
|
+
"CREATE INDEX `task_pairs_by_decision_created_at` ON `task_pairs` (`decision`,`created_at`);",
|
|
2020
|
+
"CREATE INDEX `task_pairs_by_other_id` ON `task_pairs` (`other_id`);",
|
|
2021
|
+
"CREATE INDEX `task_pairs_by_decided_by_type_decided_by_id` ON `task_pairs` (`decided_by_type`,`decided_by_id`);",
|
|
2022
|
+
"CREATE INDEX `tasks_by_title_folded` ON `tasks` (`title_folded`);",
|
|
2023
|
+
"CREATE INDEX `tasks_close_reason_to_fold` ON `tasks` (`id`) WHERE close_reason IS NOT NULL AND close_reason_folded IS NULL;",
|
|
2024
|
+
"CREATE INDEX `tasks_by_status` ON `tasks` (`project_id`,`status`,`due_at`);",
|
|
2025
|
+
"CREATE INDEX `tasks_by_project_id_status_next_check_at` ON `tasks` (`project_id`,`status`,`next_check_at`);",
|
|
2026
|
+
"CREATE INDEX `tasks_by_project_id_source_locator` ON `tasks` (`project_id`,`source_locator`);",
|
|
2027
|
+
"CREATE INDEX `tasks_by_source_group` ON `tasks` (`source_group`);",
|
|
2028
|
+
"CREATE INDEX `tasks_by_provider_external_id` ON `tasks` (`provider`,`external_id`) WHERE external_id IS NOT NULL;",
|
|
2029
|
+
"CREATE INDEX `tasks_by_parent_id` ON `tasks` (`parent_id`);",
|
|
2030
|
+
"CREATE INDEX `tasks_by_closed_by_type_closed_by_id` ON `tasks` (`closed_by_type`,`closed_by_id`);",
|
|
2031
|
+
"CREATE INDEX `tasks_by_author_type_author_id` ON `tasks` (`author_type`,`author_id`);",
|
|
2032
|
+
"CREATE INDEX `tasks_by_close_suggested_by_type_close_suggested_by_id` ON `tasks` (`close_suggested_by_type`,`close_suggested_by_id`);",
|
|
2033
|
+
"CREATE INDEX `tracker_items_by_account_id_kind_parent_id` ON `tracker_items` (`account_id`,`kind`,`parent_id`);",
|
|
2034
|
+
"CREATE UNIQUE INDEX `aliases_displayed` ON `aliases` (`aliasable_type`,`aliasable_id`,ifnull(\"account_id\", 0)) WHERE display = 1;",
|
|
2035
|
+
"CREATE UNIQUE INDEX `aliases_by_aliasable_type_aliasable_id_name_folded` ON `aliases` (`aliasable_type`,`aliasable_id`,`name_folded`) WHERE account_id IS NULL AND aliasable_type = 'project' OR account_id IS NULL AND aliasable_type = 'tag';",
|
|
2036
|
+
"CREATE INDEX `aliases_by_aliasable_type_aliasable_id` ON `aliases` (`aliasable_type`,`aliasable_id`);",
|
|
2037
|
+
"CREATE INDEX `aliases_by_account_id` ON `aliases` (`account_id`);",
|
|
2038
|
+
"CREATE INDEX `calendar_entry_participants_by_identity_id` ON `calendar_entry_participants` (`identity_id`);",
|
|
2039
|
+
"CREATE INDEX `calendar_entry_revisions_by_entry_id_created_at` ON `calendar_entry_revisions` (`entry_id`,`created_at`);",
|
|
2040
|
+
"CREATE INDEX `chat_events_by_chat_id_happened_at` ON `chat_events` (`chat_id`,`happened_at`);",
|
|
2041
|
+
"CREATE INDEX `chat_events_by_actor_identity_id` ON `chat_events` (`actor_identity_id`);",
|
|
2042
|
+
"CREATE INDEX `chat_revisions_by_chat_id_created_at` ON `chat_revisions` (`chat_id`,`created_at`);",
|
|
2043
|
+
"CREATE INDEX `chat_revisions_by_account_id_old_value` ON `chat_revisions` (`account_id`,`old_value`) WHERE field = 'external_id';",
|
|
2044
|
+
"CREATE INDEX `content_post_revisions_by_post_id_created_at` ON `content_post_revisions` (`post_id`,`created_at`);",
|
|
2045
|
+
"CREATE INDEX `conversations_by_chat` ON `conversations` (`chat_id`,`build`,`first_at`);",
|
|
2046
|
+
"CREATE INDEX `conversations_by_first_message_id` ON `conversations` (`first_message_id`);",
|
|
2047
|
+
"CREATE INDEX `crm_files_by_account_id_owner_kind_owner_id` ON `crm_files` (`account_id`,`owner_kind`,`owner_id`);",
|
|
2048
|
+
"CREATE INDEX `decision_requests_by_channel_bot_profile_chat_id_message_id` ON `decision_requests` (`channel`,`bot_profile`,`chat_id`,`message_id`);",
|
|
2049
|
+
"CREATE INDEX `document_changes_by_account_id_at` ON `document_changes` (`account_id`,`at`);",
|
|
2050
|
+
"CREATE INDEX `email_recipients_by_email_id` ON `email_recipients` (`email_id`);",
|
|
2051
|
+
"CREATE INDEX `email_recipients_by_identity_id` ON `email_recipients` (`identity_id`);",
|
|
2052
|
+
"CREATE INDEX `entity_link_events_by_linkable_type_linkable_id` ON `entity_link_events` (`linkable_type`,`linkable_id`);",
|
|
2053
|
+
"CREATE INDEX `entity_link_events_by_entity_type_to_entity_id` ON `entity_link_events` (`entity_type`,`to_entity_id`);",
|
|
2054
|
+
"CREATE INDEX `events_by_time` ON `events` (`starts_at`);",
|
|
2055
|
+
"CREATE INDEX `events_by_event_series_id` ON `events` (`event_series_id`);",
|
|
2056
|
+
"CREATE INDEX `fact_removals_by_removed_at` ON `fact_removals` (`removed_at`);",
|
|
2057
|
+
"CREATE INDEX `identity_link_events_by_identity_id` ON `identity_link_events` (`identity_id`);",
|
|
2058
|
+
"CREATE INDEX `identity_link_events_by_from_person_id` ON `identity_link_events` (`from_person_id`);",
|
|
2059
|
+
"CREATE INDEX `identity_link_events_by_to_person_id` ON `identity_link_events` (`to_person_id`);",
|
|
2060
|
+
"CREATE INDEX `mailboxes_by_name_folded` ON `mailboxes` (`name_folded`);",
|
|
2061
|
+
"CREATE INDEX `mailboxes_name_to_fold` ON `mailboxes` (`id`) WHERE name_folded IS NULL;",
|
|
2062
|
+
"CREATE INDEX `member_observations_by_chat_id_observed_at_id` ON `member_observations` (`chat_id`,`observed_at`,`id`);",
|
|
2063
|
+
"CREATE UNIQUE INDEX `member_stays_open` ON `member_stays` (`chat_id`,`identity_id`) WHERE left_at IS NULL;",
|
|
2064
|
+
"CREATE INDEX `member_stays_by_identity_id` ON `member_stays` (`identity_id`);",
|
|
2065
|
+
"CREATE INDEX `member_stays_by_invited_by_identity_id` ON `member_stays` (`invited_by_identity_id`);",
|
|
2066
|
+
"CREATE UNIQUE INDEX `message_links_unique` ON `message_links` (`message_id`,ifnull(\"parent_id\", 0),`source`,`kind`,ifnull(\"build\", 0));",
|
|
2067
|
+
"CREATE INDEX `message_links_by_build` ON `message_links` (`chat_id`,`build`);",
|
|
2068
|
+
"CREATE INDEX `message_links_by_parent_id` ON `message_links` (`parent_id`);",
|
|
2069
|
+
"CREATE INDEX `message_reactions_by_identity_id` ON `message_reactions` (`identity_id`);",
|
|
2070
|
+
"CREATE INDEX `message_revisions_by_message_id` ON `message_revisions` (`message_id`);",
|
|
2071
|
+
"CREATE INDEX `message_transcripts_by_message_id` ON `message_transcripts` (`message_id`);",
|
|
2072
|
+
"CREATE INDEX `note_revisions_by_note_id` ON `note_revisions` (`note_id`);",
|
|
2073
|
+
"CREATE INDEX `organization_identities_by_organization_id` ON `organization_identities` (`organization_id`);",
|
|
2074
|
+
"CREATE INDEX `payment_allocations_by_invoice_id` ON `payment_allocations` (`invoice_id`);",
|
|
2075
|
+
"CREATE INDEX `payment_allocations_by_author_type_author_id` ON `payment_allocations` (`author_type`,`author_id`);",
|
|
2076
|
+
"CREATE INDEX `persons_by_kind` ON `persons` (`kind`);",
|
|
2077
|
+
"CREATE INDEX `persons_kind_to_work_out` ON `persons` (`id`) WHERE kind IS NULL;",
|
|
2078
|
+
"CREATE INDEX `pipeline_stage_changes_by_item_type_item_id` ON `pipeline_stage_changes` (`item_type`,`item_id`);",
|
|
2079
|
+
"CREATE INDEX `pipeline_stage_changes_by_pipeline_id` ON `pipeline_stage_changes` (`pipeline_id`);",
|
|
2080
|
+
"CREATE INDEX `pipeline_stage_changes_by_from_stage_id` ON `pipeline_stage_changes` (`from_stage_id`);",
|
|
2081
|
+
"CREATE INDEX `pipeline_stage_changes_by_to_stage_id` ON `pipeline_stage_changes` (`to_stage_id`);",
|
|
2082
|
+
"CREATE UNIQUE INDEX `pipeline_stages_by_pipeline_id_external_id` ON `pipeline_stages` (`pipeline_id`,`external_id`) WHERE external_id IS NOT NULL;",
|
|
2083
|
+
"CREATE INDEX `pipeline_stages_by_pipeline_id_position` ON `pipeline_stages` (`pipeline_id`,`position`);",
|
|
2084
|
+
"CREATE INDEX `pipeline_stages_by_base_stage_id` ON `pipeline_stages` (`base_stage_id`);",
|
|
2085
|
+
"CREATE UNIQUE INDEX `pipelines_by_account_id_kind_external_id` ON `pipelines` (`account_id`,`kind`,`external_id`) WHERE account_id IS NOT NULL AND external_id IS NOT NULL;",
|
|
2086
|
+
"CREATE UNIQUE INDEX `pipelines_by_name_folded_kind` ON `pipelines` (`name_folded`,`kind`) WHERE account_id IS NULL;",
|
|
2087
|
+
"CREATE INDEX `record_relations_by_target_type_target_external_id` ON `record_relations` (`target_type`,`target_external_id`);",
|
|
2088
|
+
"CREATE INDEX `record_relations_by_target_id` ON `record_relations` (`target_id`);",
|
|
2089
|
+
"CREATE INDEX `reminders_due` ON `reminders` (`account_id`,`state`,`due_at`);",
|
|
2090
|
+
"CREATE INDEX `reminders_by_task_id` ON `reminders` (`task_id`);",
|
|
2091
|
+
"CREATE INDEX `task_assignments_by_assignee_type_assignee_id` ON `task_assignments` (`assignee_type`,`assignee_id`);",
|
|
2092
|
+
"CREATE INDEX `templates_history_by_key_channel_language_id` ON `templates_history` (`key`,`channel`,`language`,`id`);",
|
|
2093
|
+
"CREATE INDEX `transaction_splits_by_category_folded` ON `transaction_splits` (`category_folded`);",
|
|
2094
|
+
"CREATE INDEX `transaction_splits_by_project_id` ON `transaction_splits` (`project_id`);"
|
|
2095
|
+
]
|
|
1444
2096
|
}
|
|
1445
2097
|
];
|