database-create

Using NHibernate to execute DDL statements

谁说我不能喝 提交于 2020-01-03 20:57:10
问题 How can I execute a DDL statement via NHibernate? To be clear, I don't want to auto-generate my schema from my mapping files. My DDL is stored in plain text files along the lines of: CREATE TABLE Foo (Bar VARCHAR(10)) GO CREATE TABLE Hello (World INTEGER) GO I want to cycle through these in order and execute each of them. I could just open a SqlConnection and execute via a SqlCommand but I'd like to go through NHibernate if there is a nice way to do this. This is mainly because I want to

How to create mysql database with sequelize (nodejs)

最后都变了- 提交于 2019-12-01 19:19:02
问题 I am trying to automate the process of creating db and tables as much as possible. Is it possible to create database via sequelize? Can I make a connection string that connects just to server, not to db directly? 回答1: Short Answer: Sure you can! Here's how I got it done: //create the sequelize instance, omitting the database-name arg const sequelize = new Sequelize("", "<db_user>", "<db_password>", { dialect: "<dialect>" }); return sequelize.query("CREATE DATABASE `<database_name>`;").then

How to create mysql database with sequelize (nodejs)

时间秒杀一切 提交于 2019-12-01 17:57:36
I am trying to automate the process of creating db and tables as much as possible. Is it possible to create database via sequelize? Can I make a connection string that connects just to server, not to db directly? Short Answer: Sure you can! Here's how I got it done: //create the sequelize instance, omitting the database-name arg const sequelize = new Sequelize("", "<db_user>", "<db_password>", { dialect: "<dialect>" }); return sequelize.query("CREATE DATABASE `<database_name>`;").then(data => { // code to run after successful creation. }); P.S. Where to place code would depend on your need.