github polterguy/magic v9.6.8
Early left joins

latest releases: v17.3.9, v17.3.8, v17.3.7...
2 years ago

The name of this release might not sound much, but believe me you will enjoy it. The idea is that instead of waiting to join referenced tables on the client side, for then to "lookup" the field from the referenced table, Magic will now perform an automatic left join on your field from the referenced table, reducing the number of HTTP requests by sometimes as much as 95%.

The basic idea is really simple in fact. As Magic is generating the CRUD backend, Magic will retrieve all foreign keys for each table it is "crudifying". Once it has the keys, it asks the user what "display field" to display to the end user from the referenced table. This is a part of the per table configuration parts when generating your CRUD backend. This allows you to transform things such as for instance order.customer_id into customers.full_name etc. Magic will still keep the customer_id column by default as the result of its HTTP GET invocations, but it will add another column with the name of customer_id.full_name for the previous example. Then during the scaffolding of the frontend, it will only display the customer_id.full_name column, and not the original customer_id column. In addition, the GET HTTP endpoint (CRUD "read") will allow for being parametrised with the left join columns doing a like lookup (by default), allowing you to filter the thing, as if it was a "virtual table" (almost).

I have tested this fairly extensively, and among other things, Magic should now work with "namespaced" tables, such as for instance the "BikeStores" example (search for it online) that has multiples "schemas" where the different tables are grouped into separated "namespaces". The latter was always a challenge for me, but should work out of the box now.

The frontend scaffolding also supports having multiple tables (components) with the same name, and will create the correct folder/service/component-name according to the table's/component's "namespace". This allows you to crudify multiple modules, with overlapping table names, and still have the thing work perfectly.

Also, the frontend scaffolding process will try to "intelligently guess" which order you want your columns by, such as prioritising columns of type string, columns with the word "name" in them, referenced columns (lookups into other tables, the left join parts from above), etc, etc, etc.

According to the best of my knowledge - And I have gone through a lot of different database schemas, both for MySQL and SQL Server - There are now almost no changes I would want to do to the end result after the scaffolder is done doing its thing to have basic CRUD up working from my frontend.

This is a kick ass cool release if you ask me ^_^

Don't miss a new magic release

NewReleases is sending notifications on new releases.