lifeling
lifeling
AEAsh Elixir
Created by lifeling on 2/3/2023 in #support
Relationship expects Destination Field
I'm sure this is so basic but I keep running into this when adding relationships. I haven't tried anything very complicated.. just adding simple has_one relationships. I keep getting:
[{
"message": "an exception was raised:\n ** (Spark.Error.DslError) [FlowerShopApp.Accounts.Staff]\n relationships -> person:\n Relationship `person` expects destination field `staff_id` to be defined on FlowerShopApp.Accounts.Person\n (ash 2.5.16)
etc...
[{
"message": "an exception was raised:\n ** (Spark.Error.DslError) [FlowerShopApp.Accounts.Staff]\n relationships -> person:\n Relationship `person` expects destination field `staff_id` to be defined on FlowerShopApp.Accounts.Person\n (ash 2.5.16)
etc...
Here is my staff relationships:
relationships do
has_one :person, FlowerShopApp.Accounts.Person
end
relationships do
has_one :person, FlowerShopApp.Accounts.Person
end
And my Person attributes:
attributes do
uuid_primary_key :id

attribute :first_name, :string
attribute :last_name, :string
attribute :phone, :string
attribute :address_1, :string
attribute :address_2, :string
attribute :city, :string
attribute :state, :string
attribute :zip, :string
attribute :country, :string
end
attributes do
uuid_primary_key :id

attribute :first_name, :string
attribute :last_name, :string
attribute :phone, :string
attribute :address_1, :string
attribute :address_2, :string
attribute :city, :string
attribute :state, :string
attribute :zip, :string
attribute :country, :string
end
No person relationships ATM. What am I missing?
10 replies
AEAsh Elixir
Created by lifeling on 2/1/2023 in #support
Postgres Citext?
Trying to setup Ash Authentication and have gone through the getting started in the docs. Now running into this error when trying to run migrations.
15:12:01.856 [info] create table users
** (Postgrex.Error) ERROR 42704 (undefined_object) type "citext" does not exist
(ecto_sql 3.9.2) lib/ecto/adapters/sql.ex:913: Ecto.Adapters.SQL.raise_sql_call_error/1
(elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(ecto_sql 3.9.2) lib/ecto/adapters/sql.ex:1005: Ecto.Adapters.SQL.execute_ddl/4
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:326: Ecto.Migration.Runner.log_and_execute_ddl/3
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:117: anonymous fn/6 in Ecto.Migration.Runner.flush/0
(elixir 1.14.2) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:116: Ecto.Migration.Runner.flush/0
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:289: Ecto.Migration.Runner.perform_operation/3
15:12:01.856 [info] create table users
** (Postgrex.Error) ERROR 42704 (undefined_object) type "citext" does not exist
(ecto_sql 3.9.2) lib/ecto/adapters/sql.ex:913: Ecto.Adapters.SQL.raise_sql_call_error/1
(elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(ecto_sql 3.9.2) lib/ecto/adapters/sql.ex:1005: Ecto.Adapters.SQL.execute_ddl/4
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:326: Ecto.Migration.Runner.log_and_execute_ddl/3
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:117: anonymous fn/6 in Ecto.Migration.Runner.flush/0
(elixir 1.14.2) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:116: Ecto.Migration.Runner.flush/0
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:289: Ecto.Migration.Runner.perform_operation/3
As far as I can tell I have installed this extension. but the error persists. The user.ex file is unchanged from the docs.
8 replies
AEAsh Elixir
Created by lifeling on 1/23/2023 in #support
Multiple Relationships with single attribute.
I'm setting up my resources (Flower Shop). I have a people resource and an order resource. My order resource will have at least 3 attributes that can be people. a person can be the *designer *of an order, a person can be the *salesperson *for an order, and a person could be the *driver *for an order. I've struggled to find a good example of this.
4 replies