Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
_build
_checkouts
.git
.github
.claude
*.crashdump
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ services:
command: -c 'max_connections=2000'
environment:
POSTGRES_PASSWORD: root
POSTGRES_DB: chatli
ports:
- 5555:5432
volumes:
- ./sql:/docker-entrypoint-initdb.d
adminer:
image: adminer
ports:
Expand Down
23 changes: 0 additions & 23 deletions sql/10_ldf.sql

This file was deleted.

70 changes: 0 additions & 70 deletions sql/20_chatli.sql

This file was deleted.

12 changes: 12 additions & 0 deletions sql/seed.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Sample users for local dev and tests. Apply AFTER the app has booted
-- and run its kura migrations (tables are created on boot, not here):
-- docker exec chatli-db-1 psql -U postgres -d chatli -f /seed/seed.sql
INSERT INTO chatli_user (id, username, phone_number, email, password)
VALUES (gen_random_uuid(), 'alice', '461234', 'alice@example.com', 'alice')
ON CONFLICT DO NOTHING;
INSERT INTO chatli_user (id, username, phone_number, email, password)
VALUES (gen_random_uuid(), 'bob', '462345', 'bob@example.com', 'bob')
ON CONFLICT DO NOTHING;
INSERT INTO chatli_user (id, username, phone_number, email, password)
VALUES (gen_random_uuid(), 'ceasar', '463456', 'ceasar@example.com', 'ceasar')
ON CONFLICT DO NOTHING;
1 change: 1 addition & 0 deletions src/chatli_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
%%====================================================================

start(_StartType, _StartArgs) ->
{ok, _} = kura_migrator:migrate(chatli_repo),
chatli_sup:start_link().

%%--------------------------------------------------------------------
Expand Down
60 changes: 60 additions & 0 deletions src/migrations/m20260624090455_update_schema.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
-module(m20260624090455_update_schema).
-behaviour(kura_migration).
-include_lib("kura/include/kura.hrl").
-export([up/0, down/0]).

up() ->
[{create_table, <<"attachment">>, [
#kura_column{name = id, type = uuid, primary_key = true},
#kura_column{name = chat_id, type = uuid, nullable = false},
#kura_column{name = mime, type = string, nullable = false},
#kura_column{name = length, type = integer}
]},
{create_table, <<"callback">>, [
#kura_column{name = id, type = uuid, primary_key = true},
#kura_column{name = user_id, type = uuid, nullable = false},
#kura_column{name = url, type = string, nullable = false}
]},
{create_table, <<"chat">>, [
#kura_column{name = id, type = uuid, primary_key = true},
#kura_column{name = name, type = string, nullable = false},
#kura_column{name = description, type = string},
#kura_column{name = type, type = string}
]},
{create_table, <<"chatli_user">>, [
#kura_column{name = id, type = uuid, primary_key = true},
#kura_column{name = username, type = string, nullable = false},
#kura_column{name = phone_number, type = string},
#kura_column{name = email, type = string},
#kura_column{name = avatar, type = string},
#kura_column{name = password, type = string, nullable = false}
]},
{create_table, <<"device">>, [
#kura_column{name = id, type = uuid, primary_key = true},
#kura_column{name = user_id, type = uuid, nullable = false},
#kura_column{name = name, type = string}
]},
{create_table, <<"message">>, [
#kura_column{name = id, type = uuid, primary_key = true},
#kura_column{name = chat_id, type = uuid, nullable = false},
#kura_column{name = payload, type = jsonb},
#kura_column{name = sender, type = uuid, nullable = false},
#kura_column{name = type, type = string},
#kura_column{name = action, type = string},
#kura_column{name = timestamp, type = integer},
#kura_column{name = sender_info, type = jsonb}
]},
{create_table, <<"participant">>, [
#kura_column{name = id, type = id, primary_key = true},
#kura_column{name = chat_id, type = uuid},
#kura_column{name = user_id, type = uuid}
]}].

down() ->
[{drop_table, <<"attachment">>},
{drop_table, <<"callback">>},
{drop_table, <<"chat">>},
{drop_table, <<"chatli_user">>},
{drop_table, <<"device">>},
{drop_table, <<"message">>},
{drop_table, <<"participant">>}].
15 changes: 0 additions & 15 deletions src/schemas/ldf_message.erl

This file was deleted.

19 changes: 0 additions & 19 deletions src/schemas/li.erl

This file was deleted.

Loading