The latest release of Magic contains one extremely important new feature; Automatically handling foreign keys. This was always a source of irritation for me personally as I used Magic to generate frontends, since it forced me to manually setting up such relationships after I had generated the frontend using the CRUD menu item from the Magic Dashboard. Now this is a simple configuration as you generate your backend. See the following screenshot for how it looks like as you generate your app.

Then as you get your result, the above translates into the following.

Notice how the CRUD generator is able to automatically retrieve all foreign keys from the table, and automatically suggest lookup fields from the foreign table. For me manually editing the code after the scaffolding to accommodate for the above, would typically take a couple of days after the CRUD generator had done its thing, depending upon the complexity of the database schema of course. Now it’s an integrated part of the automatic CRUD generator, and simply “taken care of” out of the box. If you want to play around with an example frontend that was automatically generated using this feature, you can check out the updated Sakila app. Login with admin/admin to enter the app. To try it out for yourself, you can get started here. Pretty cool if I may say so myself ^_^

Leave a Comment

Your email address will not be published. Required fields are marked *