Context I have recently implemented a multitenancy setup using Apartment and PostgreSQL Schemas. It was a legacy application with low number of high value tenants with separate databases. Problem Previously, the data of each tenant was stored in separate database which shared the same database structure as the main one. After changing application to support switching PostgreSQL schemas using…
Context It can be cumbersome sometimes to go and check Gitlab CI pipeline to see what automated tests failed. We can reduce number of extra clicks that developers have to perform through Gitlab GUI to see the results. Solution We can achive this by providing JUnit reports to be used and displayed nicely within each Merge Request. To do this in RSpec in a Ruby application follow steps below: Add…
Context Quiet often you will face a need to run tasks, custom scripts, cleanups, firing background processes for your application, rotate logs and more on a recurring schedule. I personally use cron to backup databases, automatically update SSL certificates using Let's Encrypt, and to clean up /tmp folder. Unix provides us with Cron service which reads the crontab file and looks up few other…
Context There are times when you need to have a history of changes made on key entities in the database in Rails. There are few tools already for this such as audited. However, audited is tracking every change made on the model that it has been plugged into. In our case, we did not need to create unnecessary audits. We wanted to selectively track changes on records where we found it crucial to…
Before we start This post assumes that you are aware of database indices and performance benefits they can bring. If not, please check out this link for a quick introduction. Context Yesterday, I noticed a very slow background process for a rather small task through Appsignal. Quickly checking the codebase, the problem was because of doing a full text search on a column in the table with over 2+…
Context Working with Ebics (Electronic Banking Internet Communication Standard) and European banking transactions, you may have come across with SEPA Reason Codes. I am not going to explain their role within Ebics as it’s already very well explained by European council here. Basically, they are codes that are used in exception handling of bank transactions. When something goes wrong, they…
Context It’s not often I get excited about programming languages since meeting Ruby in 2015. Way before that, drowning in misery of writing university course works in Java, has pushed me away from development. Ruby’s freedom and expressiveness was what pulled me back, and its style has kept me in. I was on the lookout for another language to expand my tooling, and came across a few,…
Context It was Friday evening when I pushed my changes, waiting for CI pipeline to show green, so that I can merge my merge request. But, no! Something has to go wrong, and it did, as it happens almost once a month with rails-assets, which was down. It has been a while since the new kid on the block is not new anymore, whom everyone started to use. Also, the occasionally maintained bower, and…
Context There are times when we need to work with parent records within our database. A practical example we will use today is Pages table with a parent_id column, referencing another Page record. This will be used in building page breadcrumbs(parents) and fetching recommended pages(siblings). pizza_recipe_page = Page.last recipes_page = pizza_recipe_page.parent This builds up a tree like…
Context SEPA, also known as Single European Payment Area, is a system of tools/technologies/regulations, facilitating simplifacation of bank transfers denominated in EUR. There are quite a few steps involved in processing SEPA transactions from start to end. These include: management of EBICS users generation of XML documents with different formats; depending on your needs communicating XML files…