wallyfoo

wallyfoo

Long story short, I have a real world need to create a view for hooking up a shipping terminal to live data, but because of some early architecture decisions, using a view isn’t practical in this case. (The shipping software doesn’t do joins, only single table access, hence a view.)

I populated a lookup table with the data the shipping software needs, but if a customer changes their shipping information on their account, an update trigger to also update the associated lookup table seems smart. I have a solution that updates the data, but I would like the database to deal with itself rather than bolting logic onto the application.

Understanding that this isn’t a terribly common problem to solve, I’m not finding a lot of resources on how to deal with triggers with Ecto. The Little Ecto Cookbook, for instance, doesn’t seem to reference this sort of thing.

Anyone know of a good place to start with triggers and Ecto?

Showing Posts 1 to 2

LostKobrakai

LostKobrakai

Besides migrations basically nothing of ecto cares or need to care about triggers. As for migrations there’s no ecto specific API for triggers so your only option is to use execute/2 to run raw sql. Given that context it makes sense that there’s not much documentation, as there’s actually nothing ecto specific to document in the first place. Take whatever resource you can find about the sql side of things and you should be able to put the sql into a migration to execute.

wallyfoo

wallyfoo OP

I should have been more clear in my explanation. I was looking at it from the migration end, so execute/2 to define the trigger is likely the way to go. This is precisely what I was looking for. Thanks!

— All posts loaded —

Where Next? Top

Trending in Chat/Questions Top

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