diff --git a/config/config.exs b/config/config.exs new file mode 100644 index 0000000..d8d9c5a --- /dev/null +++ b/config/config.exs @@ -0,0 +1,7 @@ +import Config + +config :resource_owner, ResourceOwner.Repo, + database: "packet_api_development", + username: "postgres", + password: "postgres", + hostname: "localhost" diff --git a/lib/resource_owner/application.ex b/lib/resource_owner/application.ex new file mode 100644 index 0000000..3de414e --- /dev/null +++ b/lib/resource_owner/application.ex @@ -0,0 +1,12 @@ +defmodule ResourceOwner.Application do + use Application + + @impl true + def start(_type, _args) do + children = [ + ResourceOwner.Repo, + ] + opts = [strategy: :one_for_one, name: ResourceOwner.Supervisor] + Supervisor.start_link(children, opts) + end +end diff --git a/lib/resource_owner/organization.ex b/lib/resource_owner/organization.ex new file mode 100644 index 0000000..f9fa0b6 --- /dev/null +++ b/lib/resource_owner/organization.ex @@ -0,0 +1,7 @@ +defmodule ResourceOwner.Organization do + use Ecto.Schema + + schema "organizations" do + field :name, :string + end +end diff --git a/lib/resource_owner/repo.ex b/lib/resource_owner/repo.ex new file mode 100644 index 0000000..3f6684e --- /dev/null +++ b/lib/resource_owner/repo.ex @@ -0,0 +1,5 @@ +defmodule ResourceOwner.Repo do + use Ecto.Repo, + otp_app: :resource_owner, + adapter: Ecto.Adapters.Postgres +end diff --git a/mix.exs b/mix.exs index de85cab..ce424ba 100644 --- a/mix.exs +++ b/mix.exs @@ -14,13 +14,16 @@ defmodule ResourceOwner.MixProject do # Run "mix help compile.app" to learn about applications. def application do [ - extra_applications: [:logger] + extra_applications: [:logger], + mod: {ResourceOwner.Application, []} ] end # Run "mix help deps" to learn about dependencies. defp deps do [ + {:ecto_sql, "~> 3.10"}, + {:postgrex, ">= 0.0.0"} # {:dep_from_hexpm, "~> 0.3.0"}, # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"} ] diff --git a/mix.lock b/mix.lock new file mode 100644 index 0000000..20497f6 --- /dev/null +++ b/mix.lock @@ -0,0 +1,8 @@ +%{ + "db_connection": {:hex, :db_connection, "2.5.0", "bb6d4f30d35ded97b29fe80d8bd6f928a1912ca1ff110831edcd238a1973652c", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c92d5ba26cd69ead1ff7582dbb860adeedfff39774105a4f1c92cbb654b55aa2"}, + "decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"}, + "ecto": {:hex, :ecto, "3.10.1", "c6757101880e90acc6125b095853176a02da8f1afe056f91f1f90b80c9389822", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d2ac4255f1601bdf7ac74c0ed971102c6829dc158719b94bd30041bbad77f87a"}, + "ecto_sql": {:hex, :ecto_sql, "3.10.1", "6ea6b3036a0b0ca94c2a02613fd9f742614b5cfe494c41af2e6571bb034dd94c", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.10.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16.0 or ~> 0.17.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f6a25bdbbd695f12c8171eaff0851fa4c8e72eec1e98c7364402dda9ce11c56b"}, + "postgrex": {:hex, :postgrex, "0.17.1", "01c29fd1205940ee55f7addb8f1dc25618ca63a8817e56fac4f6846fc2cddcbe", [:mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "14b057b488e73be2beee508fb1955d8db90d6485c6466428fe9ccf1d6692a555"}, + "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, +}