Skip to content

Commit

Permalink
build: implement db migrations with dbmate
Browse files Browse the repository at this point in the history
  • Loading branch information
crazybolillo committed Jul 30, 2024
1 parent a45ef5c commit d0e5dc0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
13 changes: 2 additions & 11 deletions schema.sql → ...tions/20240730043324_asterisk_v21_3_1.sql
Original file line number Diff line number Diff line change
@@ -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',
Expand Down Expand Up @@ -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
5 changes: 5 additions & 0 deletions db/migrations/20240730044930_cdr_id.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- migrate:up
ALTER TABLE CDR ADD COLUMN id BIGSERIAL PRIMARY KEY;

-- migrate:down

1 change: 1 addition & 0 deletions internal/sqlc/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sqlc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
sql:
- engine: postgresql
queries: queries.sql
schema: schema.sql
schema: db/migrations
gen:
go:
package: sqlc
Expand Down

0 comments on commit d0e5dc0

Please sign in to comment.