Switch to sqlite (#22)

* Updated project to use sqlite

* Edited migrations directly because I fear no man

* Updated search functions and tests to work with sqlite

* Updated build tools to remove postgres
This commit is contained in:
Kieran
2024-02-16 17:11:41 -08:00
committed by GitHub
parent 53bd8681c3
commit b81c8d64b3
29 changed files with 121 additions and 186 deletions
+1
View File
@@ -29,6 +29,7 @@ config :pinchflat, PinchflatWeb.Endpoint,
live_view: [signing_salt: "/t5878kO"]
config :pinchflat, Oban,
engine: Oban.Engines.Lite,
repo: Pinchflat.Repo,
# Keep old jobs for 30 days for display in the UI
plugins: [{Oban.Plugins.Pruner, max_age: 30 * 24 * 60 * 60}],
+2 -6
View File
@@ -6,13 +6,9 @@ config :pinchflat,
# Configure your database
config :pinchflat, Pinchflat.Repo,
username: System.get_env("POSTGRES_USER"),
password: System.get_env("POSTGRES_PASSWORD"),
hostname: System.get_env("POSTGRES_HOST"),
database: "pinchflat_dev",
stacktrace: true,
database: Path.expand("../priv/repo/pinchflat_dev.db", Path.dirname(__ENV__.file)),
show_sensitive_data_on_connection_error: true,
pool_size: 10
pool_size: 5
# For development, we disable any cache and enable
# debugging and code reloading.
+6 -10
View File
@@ -21,20 +21,16 @@ if System.get_env("PHX_SERVER") do
end
if config_env() == :prod do
database_url =
System.get_env("DATABASE_URL") ||
database_path =
System.get_env("DATABASE_PATH") ||
raise """
environment variable DATABASE_URL is missing.
For example: ecto://USER:PASS@HOST/DATABASE
environment variable DATABASE_PATH is missing.
For example: /etc/pinchflat/pinchflat.db
"""
maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: []
config :pinchflat, Pinchflat.Repo,
# ssl: true,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
socket_options: maybe_ipv6
database: database_path,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "5")
# The secret key base is used to sign/encrypt cookies and other secrets.
# A default value is used in config/dev.exs and config/test.exs but you
+3 -6
View File
@@ -14,12 +14,9 @@ config :pinchflat, Oban, testing: :manual
# to provide built-in test partitioning in CI environment.
# Run `mix help test` for more information.
config :pinchflat, Pinchflat.Repo,
username: System.get_env("POSTGRES_USER"),
password: System.get_env("POSTGRES_PASSWORD"),
hostname: System.get_env("POSTGRES_HOST"),
database: "pinchflat_test#{System.get_env("MIX_TEST_PARTITION")}",
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: 10
database: Path.expand("../priv/repo/pinchflat_test.db", Path.dirname(__ENV__.file)),
pool_size: 5,
pool: Ecto.Adapters.SQL.Sandbox
# We don't run a server during test. If one is required,
# you can enable the server option below.