Skip to content

Commit

Permalink
Remove id and add stripe_id
Browse files Browse the repository at this point in the history
  • Loading branch information
joshsmith committed Oct 23, 2016
1 parent c74f700 commit 33c80b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions priv/repo/migrations/20161020144622_create_stripe_account.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ defmodule CodeCorps.Repo.Migrations.CreateStripeAccount do
use Ecto.Migration

def change do
create table(:stripe_accounts, primary_key: false) do
add :id, :string, primary_key: :true
create table(:stripe_accounts) do
add :business_name, :string
add :business_url, :string
add :charges_enabled, :boolean
Expand All @@ -13,6 +12,7 @@ defmodule CodeCorps.Repo.Migrations.CreateStripeAccount do
add :display_name, :string
add :email, :string
add :managed, :boolean
add :stripe_id, :string
add :support_email, :string
add :support_phone, :string
add :support_url, :string
Expand All @@ -23,6 +23,6 @@ defmodule CodeCorps.Repo.Migrations.CreateStripeAccount do
timestamps()
end

create unique_index(:stripe_accounts, [:id])
create unique_index(:stripe_accounts, [:stripe_id])
end
end
4 changes: 1 addition & 3 deletions web/models/stripe_account.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ defmodule CodeCorps.StripeAccount do

use CodeCorps.Web, :model

@primary_key {:id, :string, []} # set primary key as string
@derive {Phoenix.Param, key: :id} # set method of determining primary key for route
schema "stripe_account" do
field :business_name, :string
field :business_url, :string
Expand All @@ -17,6 +15,7 @@ defmodule CodeCorps.StripeAccount do
field :display_name, :string
field :email, :string
field :managed, :boolean
field :stripe_id, :string
field :support_email, :string
field :support_phone, :string
field :support_url, :string
Expand All @@ -33,6 +32,5 @@ defmodule CodeCorps.StripeAccount do
def changeset(struct, params \\ %{}) do
struct
|> cast(params, [])
|> validate_required([])
end
end

0 comments on commit 33c80b2

Please sign in to comment.