Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save victorusachev/087c739d9372f32028af61325cc19a9b to your computer and use it in GitHub Desktop.

Select an option

Save victorusachev/087c739d9372f32028af61325cc19a9b to your computer and use it in GitHub Desktop.
SELECT
mcl.changes #>> '{name, old_value, repr}'
FROM history_modelchangelog as mcl
WHERE (
mcl.action = 'updated'
AND (mcl.changes #>> '{name, new_value, repr}') = %(new_name)s
AND (mcl.changes #>> '{name, old_value, repr}') IS NOT NULL
AND mcl.content_type_id = %(content_type_id)s
AND mcl.object_id = %(object_id)s
)
ORDER BY mcl.updated_at DESC
LIMIT 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment