![]() You know, the one you do for a living, not just because your love to write code. Now it’s time to talk about some real stuff. Logidze ❤️ F(x) Active Record time travel in the wild Now, if you have the fx gem installed in your project, Logidze generates functions and triggers using F(x) under the hood automatically. So I decided to integrate F(x) into Logidze, and it solved the main problem: no matter if you use schema.rb, or structure.sql, Logidze has got you covered! There are also activerecord-postgres_enum and Scenic to make PostgreSQL enums and views compatible with schema.rb, respectively. ![]() sql files and provides an API to “load” them into your Ruby migrations and the schema.rb. It is a Rails-only library that allows you to declare your SQL functions and triggers in separate. Well, it used to mean that.Įverything changed when I discovered a real gem- F(x). No triggers mean no fast model tracking and no Logidze. ![]() I’ve always seen opting for structure.sql instead of schema.rb as a necessary evil: yes, it’s not fun to resolve merge conflicts in SQL, and schema.rb is way more concise, but it does not support some PostgreSQL features like triggers, sequences, stored procedures or check constraints (only added in Rails 6.1). If you have never felt the need to use plain SQL format for schema or never saw in the wild: here’s the great post from AppSignal that explains everything about the two formats.Ĭheck out 1.0 release notes for the full list of changes. In the past, Logidze could only work with an SQL format for schemas, the structure.sql. The main feature of the latest release is the support for a default Rails way to store a database schema: the schema.rb. In this detailed video, Ruby on Rails enthusiast Patryk Rogala explains everything about Logidze. It helped me discover and cut all the rough edges, so keep reading to see what changed. I’ve been developing Logidze for almost half a decade, but only recently I was able to “dogfood” it properly inside a large Rails codebase. If you want to know how this approach compares in speed to other popular Ruby gems like PaperTrail and Audited, check out my post where I introduce Logidze to the world back in 2016. ![]() Keep the changelog next to the record data (in a log_data Postgres’ JSONB column).MySQL is not supported yet, but it’s a matter of one solid PR. No Active Record callbacks (can be confusing and hard to maintain), Ruby or Rails code (not too fast), just plain old PostgreSQL triggers (fast and robust). Use database triggers to track changes.Under the hood, Logidze is based on just two ideas: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |