diff --git a/schema.sql b/db/migrations/20240730043324_asterisk_v21_3_1.sql similarity index 99% rename from schema.sql rename to db/migrations/20240730043324_asterisk_v21_3_1.sql index 4cafb98..ee989ec 100644 --- a/schema.sql +++ b/db/migrations/20240730043324_asterisk_v21_3_1.sql @@ -1,14 +1,4 @@ -SET statement_timeout = 0; -SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); -SET check_function_bodies = false; -SET xmloption = content; -SET client_min_messages = warning; -SET row_security = off; - +-- migrate:upclear CREATE TYPE public.ast_bool_values AS ENUM ( '0', '1', @@ -1185,3 +1175,4 @@ CREATE INDEX voicemail_mailbox_context ON public.voicemail USING btree (mailbox, ALTER TABLE ONLY public.musiconhold_entry ADD CONSTRAINT fk_musiconhold_entry_name_musiconhold FOREIGN KEY (name) REFERENCES public.musiconhold(name); +-- migrate:down diff --git a/db/migrations/20240730044930_cdr_id.sql b/db/migrations/20240730044930_cdr_id.sql new file mode 100644 index 0000000..7f92061 --- /dev/null +++ b/db/migrations/20240730044930_cdr_id.sql @@ -0,0 +1,5 @@ +-- migrate:up +ALTER TABLE CDR ADD COLUMN id BIGSERIAL PRIMARY KEY; + +-- migrate:down + diff --git a/internal/sqlc/models.go b/internal/sqlc/models.go index e0b1aae..c973113 100644 --- a/internal/sqlc/models.go +++ b/internal/sqlc/models.go @@ -1586,6 +1586,7 @@ type Cdr struct { Linkedid pgtype.Text `json:"linkedid"` Peeraccount pgtype.Text `json:"peeraccount"` Sequence pgtype.Int4 `json:"sequence"` + ID int64 `json:"id"` } type Extension struct { diff --git a/sqlc.yaml b/sqlc.yaml index 7ade37e..522eb2a 100644 --- a/sqlc.yaml +++ b/sqlc.yaml @@ -2,7 +2,7 @@ version: 2 sql: - engine: postgresql queries: queries.sql - schema: schema.sql + schema: db/migrations gen: go: package: sqlc