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.

Showing Posts 1 to 2

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

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
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
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
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
ryanwinchester
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted” Version...
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
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
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
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

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews