add clothes type to clothes
This commit is contained in:
@@ -5,6 +5,7 @@ defmodule PokemonCouture.Repo.Migrations.CreateClothes do
|
||||
create table(:clothes) do
|
||||
add :name, :string
|
||||
add :color, :string
|
||||
add :type, :string
|
||||
add :location, :string
|
||||
add :game, :string
|
||||
timestamps()
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@ defmodule Parser do
|
||||
def parse do
|
||||
File.stream!("sunmoon_clothes.csv")
|
||||
|> CSV.decode!(headers: :true)
|
||||
|> Enum.map(fn x -> %Clothes{game: x["game"], location: x["location"], name: x["name"], color: x["color"]} end)
|
||||
|> Enum.map(fn x -> %Clothes{game: x["game"], location: x["location"], name: x["name"], color: x["color"], type: x["type"]} end)
|
||||
|> Enum.each(fn x -> Repo.insert!(x) end)
|
||||
end
|
||||
end
|
||||
|
||||
Repo.insert! %Clothes{game: "Tlapka", location: "Tlapkov", name: "Tlapka Hat", color: "Blue"}
|
||||
Repo.insert! %Clothes{game: "Tlapka", location: "Tlapkov", type: "hat", name: "Tlapka Hat", color: "Blue"}
|
||||
Parser.parse()
|
||||
|
||||
Reference in New Issue
Block a user