Abhinav1217

Abhinav1217

I have few node microservices connected to single postgres db. I also have an elixir service for realtime message passing between BE and FE.

I am now enhancing realtime service with some additional features, so I added ecto and ash_postgres to mix and connected with postgres. Since core app is nodejs, I want that to be source of truth for db schema changes, and elixir should pull updated schema into the model layer. We have multi schema db, and public schema would be readonly, and elx would be full access schema for elixir.

I tried this using introspex
`mix ecto.gen.schema --repo RealtimeService.Repo.Public --path lib/realtime_service/ --module-prefix RealtimeService.Db.Public.Models --schema public` and it was able to generate initial schema but it just wrote comments for fields with enums and jsonb objects. Also I could not pull updates again.

Can someone guide me properly, most of chatgpt answers were wrong, Claude helped a little but now its just imagining things. I might be a programmer for decade but I am an elixir newbie

  1. I need a way to update model layer in elixir app, from db, any changes in db schema even if only needed by elixir app, will be done from node app to maintain single source of truth for db.
  2. Need enums also, jsonb could simply be a map, and I think array were successfully pulled.
  3. I also need to be able to pull schema changes again, without overwriting everything back.

Thanks.

First 2 of 2 Posts Switch mode

zachdaniel

zachdaniel

Creator of Ash

Requires using Ash, but ash_postgres can do at least some of this. I don’t recall if we extract enums or not but that could be added likely. I think your question was tagged ash-postgres on happenstance not because you actually were using Ash, but thats what tagged me to come look :smiley:

If you use the --fragments option, it will keep a separate file per resource updated which is “managed” so as things change you can rerun and it will replace that fragment.

Abhinav1217

Abhinav1217 OP

I added ash as tag because we are planning to use it for this feature, Its still on design phase so not much has been added as of yet. This was just some attempt to check if its possible to safely maintain single source of truth for db schema.

I will try your method today and let you know.. Thanks.

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
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
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement