vinsol / nectarcommerce

Quest for customizable E-commerce - the Elixir way
323 stars 53 forks source link

Seed Database Error #80

Closed toreal closed 7 years ago

toreal commented 7 years ago

Seed Database mix run apps/nectar/priv/repo/seeds.exs

When I run above command. There are errors happened as following: ....

INSERT INTO "products" ("available_on","description","name","slug","inserted_at" ,"updated_at") VALUES ($1,$2,$3,$4,$5,$6) RETURNING "id" [{2017, 2, 9}, "Sample Product for testing with 3 variants(One Master + 3 Other)", "Sample Product 2", "sample-product-2", {{2017, 2, 9}, {1, 15, 30, 0}}, {{2017, 2, 9}, {1, 15, 30, 0 }}] [debug] QUERY OK db=16.0ms INSERT INTO "product_option_types" ("option_type_id","product_id","inserted_at", "updated_at") VALUES ($1,$2,$3,$4) RETURNING "id" [1, 1, {{2017, 2, 9}, {1, 15, 30, 0}}, {{2017, 2, 9}, {1, 15, 30, 0}}] [debug] QUERY OK db=0.0ms INSERT INTO "variants" ("bought_quantity","cost_price","is_master","product_id", "total_quantity","inserted_at","updated_at") VALUES ($1,$2,$3,$4,$5,$6,$7) RETUR NING "id" [0, #Decimal<10.0>, true, 1, 10, {{2017, 2, 9}, {1, 15, 31, 0}}, {{201 7, 2, 9}, {1, 15, 31, 0}}] [debug] QUERY OK db=0.0ms commit [] ** (KeyError) key :available_on not found in: %{cost_price: 20.0, discontinue_on : #Ecto.Date<2017-03-01>, sku: "Variant 1", variant_option_values: [%{option_typ e_id: 1, option_value_id: 1}]} (nectar) web/models/variant.ex:178: Nectar.Variant.validate_discontinue_gt_a vailable_on/2 (nectar) web/models/variant.ex:92: Nectar.Variant.create_variant_changeset/3

(nectar) lib/seed/load_products.ex:58: Seed.LoadProducts.seed_products_with_

variant/0 (elixir) lib/code.ex:370: Code.require_file/2 (mix) lib/mix/tasks/run.ex:82: Mix.Tasks.Run.run/1 (mix) lib/mix/task.ex:294: Mix.Task.run_task/3 (mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2 (elixir) lib/code.ex:370: Code.require_file/2

pikender commented 7 years ago

@toreal Changes are being merged to master and few more fixes along with it. Feel free to share any feedback you have. Thanks :+1: