Sakthibalan

Sakthibalan

attributes do
    attribute :id, :uuid do
      writable? false
      primary_key? true
      default &Ecto.UUID.generate/0
      allow_nil? false
      public? true
    end

    attribute :first_name, :string do
      allow_nil? false
      public? true
    end

    attribute :last_name, :string do
      allow_nil? false
      public? true
    end

    attribute :class, :string, public?: true
    attribute :section, :string, public?: true
    attribute :dob, :date, public?: true
    attribute :roll_number, :string, public?: true

    create_timestamp :inserted_at
    update_timestamp :updated_at

  end

student = Ash.get!(MyApp.Students.Student, "806b5689-faaf-4f79-a773-c2817826568e")

#MyApp.Students.Student<
  __meta__: #Ecto.Schema.Metadata<:loaded, "students">,
  id: "806b5689-faaf-4f79-a773-c2817826568e",
  first_name: "xxxx",
  last_name: "yyyyy",
  class: "1 std",
  section: "A",
  roll_number: "100",
  inserted_at: ~U[2024-05-16 05:38:10.074562Z],
  updated_at: ~U[2024-05-16 05:38:10.074562Z],
  aggregates: %{},
  calculations: %{},
  ...
>

student |> Ash.Changeset.for_update(:update, %{section: "B"}) |> Ash.update!()

↳ AshPostgres.DataLayer.update_query/4, at: lib/data_layer.ex:1289
** (Ash.Error.Unknown) Unknown Error

  • %Postgrex.Error{message: nil, postgres: %{code: :undefined_function, line: “636”, message: “function ash_raise_error(jsonb, timestamp without time zone) does not exist”, position: “93”, file: “parse_func.c”, unknown: “ERROR”, severity: “ERROR”, hint: “No function matches the given name and argument types. You might need to add explicit type casts.”, pg_code: “42883”, routine: “ParseFuncOrColumn”}, connection_id: 23725, query: “UPDATE "students" AS s0 SET "updated_at" = (CASE WHEN $1::timestamp::timestamp IS NULL THEN ash_raise_error($2::jsonb, s0."updated_at"::timestamp) ELSE $3::timestamp::timestamp END), "section" = $4::text WHERE (s0."id"::uuid = $5::uuid) RETURNING s0."id", s0."first_name", s0."last_name", s0."class", s0."section", s0."dob", s0."father_name", s0."mother_name", s0."roll_number", s0."password", s0."inserted_at", s0."updated_at"”}

Showing Posts 1 to 3

kamaroly

kamaroly

@Sakthibalan do you have “ash-functions” in your installed_extensions section in the Repo?
If not, add it and try again. Here is a sample code:

  def installed_extensions do
    ["uuid-ossp", "citext", "ash-functions"]
  end
Sakthibalan

Sakthibalan OP

Yes, I had “ash-functions” already.

def installed_extensions do
    ["ash-functions"]
  end
Sakthibalan

Sakthibalan OP

@kamaroly Sorry, I deleted InstallAshFunctionsExtension file, after I restored this file. Everything is working well.

Thank you so much!

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews