I'm building an Angular Universal application using TypeORM + MySQL. Is there any way in JavaScript to programmatically create an ERD from my TypeORM specification?
I see some related things but nothing exactly what I want:
rails-erd can do what I want for Rails apps.
Mermaid can make the diagram I want from markup, but not from reading the same Angular models.
MySQL Workbench can make the ERD after TypeORM has setup the database, but this is not an all-JS solution.
ember-erd does what I want for Ember apps.
TypeScript has some kind of Swagger integration I think, so maybe there is some way to generate the ERD from that? Or is there a way to have MySQL automatically generate the ERD without installing Workbench, perhaps via a Node module?
You can implement it with cola.js on the basis of D3JS http://ialab.it.monash.edu/webcola/ It is not the ideal solution but it can be used to emulate ERD.
Related
I used Firebase before. It was super simple, but It works only with non-relational database. I want to find something similar for MySQL but open source.
I found this two:
https://directus.io/
https://strapi.io/
I can't connect both to my old database or it seems complicated. I also can't find AngularJS integration. I found JavaScript integration for Strapi, but is unmaintained (https://github.com/strapi/strapi-sdk-javascript). If you recommend Strapi or Directus, is there any easy way to connect it to old database and JavaScript sdk?
If you install Directus clean, you can then just import your existing SQL tables/content and it will let you manage it. Should be very quick and easy to setup! There's a whole community on Slack that can help you out on that too:
https://directus.chat
By using Strapi you will not be able to import a database structure and generate automatically the API from it.
After that, in few clicks you will be able to map your Strapi content types (models) on your database table structure.
Let me know if you have any questions.
After creating all database tables in MySQL or MariaDB, I am able to generate all Yii2 Models using gii by simple entering * and voila, all models are created.
My question; I was wondering if there's an equivalent way of generating all CRUD - at once - based on generated models in a similar way, either from the console with a one-liner or from the browser with the gii CRUD Generator.
Answer:
Not using standard "yiisoft/yii2-gii" unfortunately. You can compare the "generate()" functions for the model and crud to get a programmatic reason here:
Model: https://github.com/yiisoft/yii2-gii/blob/master/src/generators/model/Generator.php
CRUD: https://github.com/yiisoft/yii2-gii/blob/master/src/generators/crud/Generator.php
Solution:
You can use "schmunk42/yii2-giiant" which looks to do what you require and has decent decent support. Found here: https://github.com/schmunk42/yii2-giiant
"mootensai/yii2-enhanced-gii" is another option but was last updated August 2017. Found here: https://github.com/mootensai/yii2-enhanced-gii
I hope these help.
Im new to Angular.JS and just wondering if it is possible to write mysql queries in angularjs?
I would like this as I am trying to create a messaging system in which I query the database and get the information live to the webpage.
Any help is appreciated, hope the question is reasonable. Gab
That is not advisable (if possible at all) as it would defeat the purpose of Angular.
You should consume data by targeting a RESTful api/service exposed by the server. The service would handle the DB access for you and provide the data to Angular using a more portable format (e.g. JSON or XML)
Some of the basics of linking Angular and REST are described here
There are related questions on SO about exposing your particular DB flavor using REST here.
This can only be a starting point but it should give you some ideas. I will try to amend this with more info as I come across it.
Is there any mysql framework for node.js?
I found only https://github.com/felixge/node-mysql but this only allows executing "raw" mysql statements. I am looking for some tool which will provide easier way of manipulating mysql database and data.
Especially I need pagination and joining mechanisms...
I am not looking for a full framework because I am using restify to build RESTapi - just need a module to retrieve/save data to mysql db. So I need only "model" part of MVC ;).
It sounds like you may be looking for an ORM. If that's the case, you can take a look at Sequelize. It will let you define your objects, and then simply 'save' and 'fetch' them, without really having to worry about how its doing it.
You can look at db-mysql module. This module provides api for creating queries. Here is module GitHub page.
In our rails app we sometimes have db entries created by users that we'd like to make part of our dev environment, without exporting the whole table. So, we'd like to be able to have a special 'dev and testing' dump.
Any recommended best practices? mysqldump seems pretty cumbersome, and we'd like to pull in rails associations as well, so maybe a rake task would make more sense.
Ideas?
You could use an ETL tool like Pentaho Kettle. Once you have initial transformation setup that you want you could easily run it with different parameters in the future. This way you could also keep all your associations. I wrote a little blurb about Pentaho for another question here.
If you provide a rough schema I could probably help you get started on what your transformation would look like.
I had a similar need and I ended up creating a plugin for that. It was developed for Rails 2.x and worked fine for me, but I didn't have much use for it lately.
The documentation is lacking, but it's pretty simple. You basically install the plugin and then have a method to_sql available on all your models. Options are explained in README.
You can try it out and let me know if you have any issues, I'll try to help.
I'd go after it using a Rails runner script. That will allow your code to access the same things your Rails app would, including the database initializations. ActiveRecord will be able to take advantage of the model relationships you've defined.
Create some "transfer" tables in your production database and copy the desired data into those using the "runner" script. From there you could serialize the data, or use a dump tool, since you'll be dealing with a reduced amount of records. Reverse the process in the development environment to move the data into the database.
I had a need to populate the database in one of my apps from remote web logs and wrote a runner script that fired off periodically via cron, ftps the data from my site and inserts the data.