
JimmyCarterSon
Assistance with Schema Mix
I am confused about the Schema setup,
I am setting up a new application and I want to seed files in it as well. I tried to mix to create the schema mix phx.gen.html Delish.food delish_foods title:string ingredients:string summary:string date:integer
I keep getting this error even if I try phx.gen.schema
, the error looks like this
** (Mix) Expected the context, "Delish.food", to be a valid module name
mix phx.gen.html, phx.gen.json, phx.gen.live, and phx.gen.context
expect a context module name, followed by singular and plural names
of the generated resource, ending with any number of attributes.
For example:
mix phx.gen.html Accounts User users name:string
mix phx.gen.json Accounts User users name:string
mix phx.gen.live Accounts User users name:string
mix phx.gen.context Accounts User users name:string
The context serves as the API boundary for the given resource.
Multiple resources may belong to a context and a resource may be
split over distinct contexts (such as Accounts.User and Payments.User).
Do I just set up the schema with one title:string
?
Marked As Solved

AntonRich
I see. I got a bit confused and thought you wanted to only create Schema, but you’re trying to create Context and Schema.
mix phx.gen.html Foods Food delish_foods title:string ingredients:string summary:string date:integer
Foods - Context Module
Food - Schemade module
delish_foods - table name
It will create:
- a context module in
lib/app/foods.ex
for the accounts API - lib/app/foods - folder
- lib/app/foods/food.ex - schema module
It will also create templates, views, and a controller. It will show all the files it created in the terminal.
Popular Backend topics










Other popular topics








Latest in Backend
Latest (all)
Categories:
Popular Portals
- /elixir
- /opensuse
- /rust
- /kotlin
- /ruby
- /erlang
- /python
- /clojure
- /react
- /quarkus
- /go
- /vapor
- /v
- /react-native
- /wasm
- /django
- /security
- /nodejs
- /centos
- /rails
- /haskell
- /fable
- /gleam
- /js
- /swift
- /deno
- /assemblyscript
- /tailwind
- /laravel
- /symfony
- /phoenix
- /crystal
- /typescript
- /debian
- /adonisjs
- /julia
- /arch-linux
- /svelte
- /spring
- /flutter
- /preact
- /c-plus-plus
- /actix
- /java
- /angular
- /ocaml
- /zig
- /kubuntu
- /scala
- /zotonic
- /vim
- /rocky
- /lisp
- /html
- /keyboards
- /emacs
- /nim
- /vuejs
- /nerves
- /elm