build(phoenix): use sqlite instead of postgres

This commit is contained in:
Anhgelus Morhtuuzh 2025-08-12 13:30:01 +02:00
parent 4a0cbeb094
commit ce8d963331
Signed by: anhgelus
GPG key ID: 617773CACE89052C
10 changed files with 31 additions and 31 deletions

View file

@ -10,6 +10,8 @@ defmodule LearningPhoenix.Application do
children = [
LearningPhoenixWeb.Telemetry,
LearningPhoenix.Repo,
{Ecto.Migrator,
repos: Application.fetch_env!(:learning_phoenix, :ecto_repos), skip: skip_migrations?()},
{DNSCluster, query: Application.get_env(:learning_phoenix, :dns_cluster_query) || :ignore},
{Phoenix.PubSub, name: LearningPhoenix.PubSub},
# Start a worker by calling: LearningPhoenix.Worker.start_link(arg)
@ -31,4 +33,9 @@ defmodule LearningPhoenix.Application do
LearningPhoenixWeb.Endpoint.config_change(changed, removed)
:ok
end
defp skip_migrations?() do
# By default, sqlite migrations are run when using a release
System.get_env("RELEASE_NAME") == nil
end
end

View file

@ -1,5 +1,5 @@
defmodule LearningPhoenix.Repo do
use Ecto.Repo,
otp_app: :learning_phoenix,
adapter: Ecto.Adapters.Postgres
adapter: Ecto.Adapters.SQLite3
end

View file

@ -7,7 +7,7 @@ defmodule LearningPhoenixWeb.Endpoint do
@session_options [
store: :cookie,
key: "_learning_phoenix_key",
signing_salt: "RuSasXTJ",
signing_salt: "FPy3oQ90",
same_site: "Lax"
]