From be02a67fd00b57638615e8cd709375b85b483128 Mon Sep 17 00:00:00 2001 From: Paul Daigle Date: Sun, 21 Feb 2016 16:30:01 -0500 Subject: [PATCH] Just the repo --- config/config.exs | 8 ++++++++ lib/loggex/logline.ex | 11 +++++++++++ lib/loggex/repo.ex | 3 +++ .../migrations/20160221045342_add_loglines_table.exs | 12 ++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 lib/loggex/logline.ex create mode 100644 lib/loggex/repo.ex create mode 100644 priv/repo/migrations/20160221045342_add_loglines_table.exs diff --git a/config/config.exs b/config/config.exs index f2069fc..bbdb4be 100644 --- a/config/config.exs +++ b/config/config.exs @@ -2,6 +2,14 @@ # and its dependencies with the aid of the Mix.Config module. use Mix.Config +config :loggex, Loggex.Repo, + adapter: Ecto.Adapters.Postgres, + database: "loggex_repo", + username: "postgres", + password: "postgres", + hostname: "localhost" + + # This configuration is loaded before any dependency and is restricted # to this project. If another project depends on this project, this # file won't be loaded nor affect the parent project. For this reason, diff --git a/lib/loggex/logline.ex b/lib/loggex/logline.ex new file mode 100644 index 0000000..241f654 --- /dev/null +++ b/lib/loggex/logline.ex @@ -0,0 +1,11 @@ +defmodule Loggex.Logline do + use Ecto.Schema + import Ecto.Changeset + + schema "loglines" do + field :sender, :string + field :sendtime, Ecto.DateTime + field :responseCode, :integer + field :body, :string + end +end diff --git a/lib/loggex/repo.ex b/lib/loggex/repo.ex new file mode 100644 index 0000000..1bc9419 --- /dev/null +++ b/lib/loggex/repo.ex @@ -0,0 +1,3 @@ +defmodule Loggex.Repo do + use Ecto.Repo, otp_app: :loggex +end diff --git a/priv/repo/migrations/20160221045342_add_loglines_table.exs b/priv/repo/migrations/20160221045342_add_loglines_table.exs new file mode 100644 index 0000000..1c2e078 --- /dev/null +++ b/priv/repo/migrations/20160221045342_add_loglines_table.exs @@ -0,0 +1,12 @@ +defmodule Loggex.Repo.Migrations.AddLoglinesTable do + use Ecto.Migration + + def change do + create table(:loglines) do + add :sender, :string + add :sendtime, :datetime + add :responseCode, :integer + add :body, :string + end + end +end