Closed ghost closed 6 years ago
Hi @twisig,
I don't want to add a support for creating tables beacuse creating is a bit complex and SQL Agent supports 4 databases. Of course, you can create table via SQL Agent .query()
method: https://github.com/totaljs/node-sqlagent#query but you need to write a raw SQL QUERY.
:-1: Okay i understood but what do you think about this plugin : Knex
It's very helpfull and nice to have more capabilities with your SqlAgent. :100:
Example:
knex.schema.createTable('users', function(table) { table.increments(); table.string('name'); table.string('email', 128); table.string('role').defaultTo('admin'); table.string('password'); table.timestamps(); });
What do you think ?
My opinion: it's useless. You can easily create table via:
var sql = DB();
sql.query('CREATE TABLE users ....');
sql.exec(console.log);
I want to keep simplicity.
@twisig i uderstand what about you talk. But it's worse idea. I work so long time with DataBase and i used various approach with ORM and without ORM. My opinion EF framework good while you write little simple projects. When you wanna make somethink different, you spend a lot of time for search solution how make it in ORM. And sometime it's not working, sometime it's not implimented. If you have big team then each should know your ORM. SQL not hard for understandable and each developer should know sql. It's give more stability and flexibility.
If you like it this approach, better solution will be write of plugin for total.js. But this plugin maybe never inside in total.js. But i think @petersirka glad make row in own readme file about your plugin.
But i think @petersirka glad make row in own readme file about your plugin.
Of course
Thank you for your comment. We need to check if the connection has an issue or not. Is it possible with sqlagent ?
Example:
mongoose .connect('/path/to/your/mongo') .then((response) => { console.log('mongo connection created') }) .catch((err) => { console.log("Error connecting to Mongo") console.log(err); })
SQL Agent emits database
event:
ON('database', function() {
console.log('Mongo is ready');
});
This event is in the documentation ? I don’t found anything
Yes, it's missing... I'll add it.
Hi I’m using SQLAgent with PostgreSQL. Can you add an enhancement to create the tables automatically in PG from the model ? Thanks