add clothes type to clothes

This commit is contained in:
2021-09-24 14:43:41 +02:00
parent 2486143842
commit a8d30550ab
8 changed files with 432 additions and 428 deletions
@@ -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
View File
@@ -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()