I have an problem that I wanted to solve recently using a Postgres Trigger 
+ Procedure that I do not want to do via Signals or within Python itself.

I want to make a log which when an entry is created the result is applied 
to a row. We need the log to be the source of truth and I don't want to 
write a whole async system using something like Kafka or whatever everyone 
recommends.

The issue here is that I need to iterate on the procedure which updates the 
rows as features come along and make it easy for other developers to 
find/read/etc.

Django only allows storing things like this as RawSql migration commands 
inside the migrations folder but this App already has 76 migrations and I 
think it's probably unreasonable for me to assume a normal django developer 
will think to read all those migrations without running in to some problem 
with my triggers. Not to mention the main block of sql will need to be copy 
and pasted between changes to new migrations... etc.

This seems like something the migration system should support somehow.

I found a package which seems to do this, but it appears unmaintained 
(little to no activity): https://github.com/klichukb/django-migrate-sql

I think it'd be a nice feature for Django to support maintaining a set of 
Raw SQL via the migration system so more advanced features of databases can 
be used.

For instance in Postgres setting up other things like full text search and 
special search indexes were difficult in 1.8. I realize it's easier since 
1.10 to add a full text search index, but adding that feature is much more 
difficult than the RawSQL migrations we did to implement adding the index 
before.

Making it easy to manage triggers and procedures via the migration system 
is very difficult, but I think supporting RawSQL items which are managed 
via migrations would be relatively easy to implement and add a lot of value.

I'm posting this for two reasons: 1) I think it's a good idea and 2) to let 
others show me where I'm missing something or why this wouldn't be a good 
fit for Django.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8043d044-3f7c-4bd2-bdc4-c504faf5120b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to