Tools For Better Developers

Latest Posts

Osm Admin: Adding Explicit Properties. Data Conversions

2022 April Osm Admin

1 year ago ∙ 4 minutes read

This time, I tackled adding an explicit property to an existing table, and then making it non-nullable.

It raised the need for data conversions - additional handling of the existing data - or otherwise, the database engine fails, or the data becomes invalid.

And it made me split migrations in two parts - the one that runs before the data conversion, and the other one that runs afterwards.

Osm Admin: Schema Migrations In Development Vs Production

2022 April Osm Admin

1 year ago ∙ 2 minutes read

Schema migrations are going to be generated and executed automatically under gulp watch. It will result in lots of tiny migrations: add a column, change its type, make it not nullable, and so on.

It's convenient during development, but it might be not optimal to reapply in production. Indeed, it's better to convert a large table to new structure all at once rather than running a conversion for each of the tiny migration.

This observation contradicts the previously stated migration workflow, so let's update it.

Osm Admin: Filters

2022 January Osm Admin

2 years ago ∙ 3 minutes read

In the user interface, you can narrow displayed data using grid column filters, or filters displayed in the sidebar. To enable that, apply #[Filter\*] attributes to class properties.

Applied filters appear in the URL query parameters, for example, .../edit?id=5+16+19, and on the page.

You can apply filters not only to a grid page, but also to a form page - to mass edit all matching objects, or to an action URL (edit, delete, or custom) - to perform the action on all matching objects.

In the same way, you can apply filters to the API URLs in order to retrieve or modify matching objects in a script.

Osm Admin: Query Formulas

2021 November Osm Admin

2 years ago ∙ 3 minutes read

After 3 days of intensive work, I've got dot syntax working!

Along the way, I refactored the query internals once again, which reminds me a heuristics saying that you've got to implement something three times to get it right :)

New query implementation uses the concept of formulas - SQL-like expressions used for selecting, filtering and sorting data. Currently, formulas are quite limited, but with time, they should be a really powerful feature.

Osm Admin: Indexing (2)

2021 November Osm Admin

2 years ago ∙ 3 minutes read

Today, I implemented computation of indexed properties during insert. The implementation dictated some changes in indexed property definitions compare to the initial design, and how indexers are reflected into the data schema.

Also, I implemented a table query class working on the top of Laravel Query\Builder. More about it next time, for now I'll review how indexed properties are computed during INSERT operation.

Osm Admin: Schema Hydration

2021 November Osm Admin

2 years ago ∙ 3 minutes read

I developed dehydrate()/hydrate() functions for a very practical need - storing the data class schema:

  • in cache - to reduce processing time spent on reflection;
  • and in database - to compare current and new database schema, and only add new tables and columns.

This article describes the information stored in the schema, and unit tests that I prepared in order to be sure that schema classes are property hydrated.

Osm Admin: Subclasses

2021 November Osm Admin

2 years ago ∙ 1 minute read

As described in Migrations, most data objects of the same class will be stored in a database table.

But what about subclasses? In an e-commerce application, bags, dresses, and digital products, collectively known as subclasses, are all products stored in products table, and they may have bad-specific, dress-specific or digital product specific properties that should also be stored there.

This article describes how subclasses are defined and stored in Osm Admin.

osm.software: Deploying Updates

2021 September osm.software Website

2 years ago ∙ 2 minutes read

After pushing changes to GitHub, osm.software website is updated without any additional manual action. On push, GitHub executes the deployment script on the production server. Most changes are done to content only, and in this case, the deployment script only updates the search index. Otherwise, with the website being on maintenance, it additionally updates Composer and Node dependencies, builds JS and CSS assets, and runs the database migrations.