#1
Hello, I have a MySQL schema which was exported from phpmyadmin with 30 tables. Is it possible to import this schema via Trongate so that I don't have to create every table and field manually. Any help would be appreciated. Thanks!
#2
Hi Andrew,

If you mean, "Is it possible to upload a database schema and then have the Trongate desktop app generate all of files?", the answer is 'no'. Unfortunately.

However, it's a feature request that has come in a few times. I think it would be a super cool feature and I really hope we can have that in the future.

A gentleman by the name of Dom Sinclair built some code that does precisely that. However, I haven't seen him around for several months. Perhaps I could look him up for you. Do you want me to see if I can find him, and reach out to him on your behalf?

Also, I'm not sure what you mean by importing all of the tables manually. Surely, that's something that can be handled by clicking a simple 'Import' button - perhaps on PHPMyAdmin.

Please do feel free to ask follow up questions. The docs have a few gaps right now and I'm eager to see people get help if they need it. If you feel totally stuck, I'd be glad to arrange some kind of screen-sharing thing, if that would help.

Your questions are totally welcome and there is no such thing as a bad question.

Regards,

DC
#3
Hello,
I was looking at this. The only way for Trongate to this is to be able to modify the "Properties" field when you create a Module.
Here is an example of that field.

This would same time when you create a module and inserting the properties, aka.. the table fields.
Would be a great feature for reuse of a database.

Are you looking to just import the database, or import the database with creating the respective modules?

Dan
#4
Hi Andrew,

Great question, and I echo what both DC and Dan have said.

As DC mentioned, the Trongate Desktop App currently doesn’t support importing a full schema and auto-generating modules from it. Dan rightly pointed out the potential of automating module creation by manipulating the “Properties” field. However, that can be a rather tedious process, unless someone develops a module to convert a MySQL database schema into a compatible JSON 'properties' block for pasting into the Desktop App during module creation. This could also be a path to expand a feature into the Desktop - the GitHub repo for this can be found here --- https://github.com/trongate/trongate-desktop-app (hint hint)

Thankfully for the Trongate community, that’s exactly where Dom Sinclair’s VTL Data Generator shines.

Dom put an extraordinary amount of work into building this module and I can't emphasise enough how good this module is and in my opinion needs more recognition. It really should have been the first paid module on the https://trongate.io/module-market. Remarkably, it was his first attempt at creating one, with little to no prior experience in PHP, JavaScript or CSS. Coming from a C# and .NET background, he brought a fresh approach and tackled the Trongate framework head-on. We are incredibly fortunate to have him as part of the Trongate community.

His module introspects an existing MySQL table and generates a fully functional, CRUD-ready Trongate module complete with validation rules, search capability, pagination, and even support for picture and multi-file uploaders. It also intelligently handles foreign key relationships to maintain referential integrity. While it may not be perfect, with room to improve the UI. It is incredibly fast and ideal for bootstrapping real-world applications.

However, there hasn’t been any visible activity or updates to Dom’s module on GitHub or the Trongate 'Module Market' for about seven months. That said, it remains one of the most comprehensive tools available for generating Trongate modules from existing database tables.

• GitHub repo:
• Docs (Create Module):
Also, to note there are a few errors in v5.9 which I addressed in a previous post when user chr1974 was having a few issues:

• Fixes for v5.9 (Post #7):
• Direct download of patched version:
Dom if you read this - I may send you a PR with these fixes as well.

Cheers and happy coding!
DaFa
#5
I have been working on this feature. It Works!
There are a couple of items I need to make sure it does everything a create a new module does.
I have the folder structure, files-api,controller, view-create, manage and show.
I have added a line to the dynamic_nav.php file.
Is there anything else I am missing?
Also, I am checking for these PRIMARY|UNIQUE|KEY|CONSTRAINT|INDEX|FOREIGN. Are there any other fields I should include?
Dan
Ps. The way this works is you paste is a create table statement and it will generate all the module code.
#6
Hi Dan,

Looks like you have been busy. Can you share the file structure as you have it with the 'tree' command line tool? You can maybe also handle AUTO_INCREMENT, and any DEFAULT values.

Here is a list of MySQL field types from the employee of the month that may help too:
You may want to check some of the MariaDB specific or extended features too, like `JSON`, `TINYINT`, etc...