Reorganize repo: backend/, deploy/, docs/ layout + AGENTS.md
Restructure the monorepo into clear top-level directories: - backend/: Go module root (cmd, internal, pkg, configs, migrations, docs/swagger, scripts, tests, go.mod, Makefile, .air.toml) - deploy/: Docker (Dockerfile, docker-compose*), quickstart, fluentd - docs/: project documentation + reports/ (moved from repo root) - AGENTS.md: new AI coding-agent guide at repo root Update all references to the new layout: - Dockerfile: COPY backend/go.mod, COPY backend/ (context = repo root) - docker-compose files: context ../.., dockerfile deploy/docker/Dockerfile, env_file ../../.env, volume mounts ../../backend:/app - deploy/quickstart/compose.yaml: dockerfile deploy/docker/Dockerfile - CI: working-directory: backend for go commands, file deploy/docker/Dockerfile, coverage path backend/coverage.out, health_check backend/scripts/ - backend/Makefile: docker target uses -f ../deploy/docker/Dockerfile ../ - README: architecture tree, quickstart, config paths updated Move root stray scripts (rename_models.*, run_m11_tests.sh, verify_build.sh, gorm_bool_main.go) to backend/scripts/legacy/. All moves via git mv to preserve history. Build, vet, SQLite tests, and docker compose config verified.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
CREATE TABLE IF NOT EXISTS calls (
|
||||
id SERIAL PRIMARY KEY,
|
||||
account_id INTEGER NOT NULL,
|
||||
inbox_id INTEGER,
|
||||
conversation_id INTEGER NOT NULL,
|
||||
contact_id INTEGER,
|
||||
message_id INTEGER,
|
||||
accepted_by_agent_id INTEGER,
|
||||
provider VARCHAR(50) DEFAULT 'twilio',
|
||||
direction VARCHAR(50),
|
||||
provider_call_id VARCHAR(255),
|
||||
conference_sid VARCHAR(255),
|
||||
caller_type VARCHAR(100) NOT NULL DEFAULT '',
|
||||
caller_id INTEGER NOT NULL DEFAULT 0,
|
||||
status VARCHAR(50) NOT NULL DEFAULT 'ringing',
|
||||
duration INTEGER DEFAULT 0,
|
||||
call_direction VARCHAR(50) NOT NULL DEFAULT '',
|
||||
recording_url VARCHAR(512),
|
||||
additional_attributes JSONB DEFAULT '{}',
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
deleted_at TIMESTAMPTZ
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_calls_deleted_at ON calls(deleted_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_calls_account_id ON calls(account_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_calls_inbox_id ON calls(inbox_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_calls_conversation_id ON calls(conversation_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_calls_contact_id ON calls(contact_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_calls_message_id ON calls(message_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_calls_accepted_by_agent_id ON calls(accepted_by_agent_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_calls_provider_call_id ON calls(provider, provider_call_id);
|
||||
|
||||
ALTER TABLE calls ADD COLUMN IF NOT EXISTS started_at TIMESTAMPTZ;
|
||||
ALTER TABLE calls ADD COLUMN IF NOT EXISTS end_reason VARCHAR(255);
|
||||
Reference in New Issue
Block a user