Part 1 - DDL to Laravel
It is not uncommon for a Laravel project. To start with data. A company will come to you with the database that they already have, need to tightly interface with a tool that does not have an API, or you’ll be rewriting an existing application that needs to run in parallel with the new one.
The process of setting up those database objects can be a little bit of a slog. The ability to play around with the database through the tinker console can really inform how you structure the new application. So I started thinking about automating that process.
Over the weekend I refreshed a repo that I had started a couple years ago. I want to support the four database drivers that are supported natively in Laravel: MySQL, Postgresql, MsSQL and Sqlite. I started by implementing connectors for all of the Microsoft SQL databases, I’m not sure if they’ve resolved it yet, but for the longest time you couldn’t run Microsoft SQL server in a docker container on the Mac.
I think I have a good idea on how to handle identification of columns, there will need to be a hierarchy of some sort. An ID column of course is going to also be an integer column, but most integer columns are not going to be the primary key or increment automatically. When we meet those conditions we’ll cascade down to that.