For the sequelize-auto npm package, which generates sequelize models from a database.
Questions tagged [sequelize-auto]
34 questions
8
votes
1 answer
sequelize-auto TypeError: connection.query(...).on is not a function
I tried to use sequelize-auto to automatically generate models from existing PostgreSQL tables for SequelizeJS.
npm install -g sequelize-auto pg
sequelize-auto -o "./models" -d myDatabase -h localhost -u myUsername -p 5432 -x myPassword -e…

Yuci
- 27,235
- 10
- 114
- 113
4
votes
2 answers
What is the references field for in sequelize?
I have a user table that has a foreign key column to a roles table.
I defined all relationships in mysql and using sequelize-auto I generated my models.
The generated model for user was this:
const user = sequelize.define('user', {
Id: {
…

CodingLittle
- 1,761
- 2
- 17
- 44
4
votes
0 answers
Sequelize Create/Import Dynamically Generated Models
I have a Sequelize migration script (built off sequelize-cli's initial migration script generated from running sequelize-cli) that dynamically creates tables based on a list of ~100 hardcoded table names imported from a .json file. Thus, it will be…

Nyxynyx
- 61,411
- 155
- 482
- 830
4
votes
2 answers
sequelize-auto --config option
I have a database already built and I am using it with Sequelize ORM. The database already has timestamp columns as "created_at" and "updated_at".
To generate sequelize Models I used sequelize-auto and it generated all the models with one command.…

Amarjit Singh
- 2,068
- 19
- 52
3
votes
1 answer
Auto generate models in Nest js from existing SQL Server DB using Sequelize
I am working on an API using Nest js that has to connect to an existing database.
There are so many tables that cannot be manage manually for creating the entity tables in Nest.
I am using sequelize.
Is there a way that I can auto generate…

Mark musisha
- 31
- 2
3
votes
1 answer
Getting error in this line `Cannot use namespace 'DataTypes' as a type.ts(2709)`
I used the below configuration to generate models
const auto = new SequelizeAuto(
process.env.DB_NAME,
process.env.DB_USER,
process.env.DB_PASS,
{
host: process.env.DB_HOST,
dialect: 'mysql',
typescript: true,
camelCaseForFileName: true,
…

anjnkmr
- 838
- 15
- 37
3
votes
1 answer
Sequelize - Update table that has trigger on it - not working
I am kinda of new with Sequelize and Node.js
I am trying to use Sequelize with a MSSQL database and figure out what i can do with it.
I've established the connection, created a model based on a existing table.
Such table has multiple triggers on…

Tom
- 103
- 6
1
vote
0 answers
Getting "no pg_hba.conf entry for host" when using sequelize-auto to generate models from a database on Heroku
I have a database on Heroku with some tables.
I have these config vars set for my app
I run this command with sequelize-auto to generate models from the database
sequelize-auto -h (host) -d (database) -u (user) -x (password) -p (port) --dialect…

sunny tran
- 21
- 1
1
vote
1 answer
Sequelize 'no such table:' despite table and database clearly existing and correctly configured
Good evening.
I'm building an Express REST API using SQLite, with Sequelize being my ORM of choice.
I was working with an existing database, so I used a package called sequelize-auto in order
to generate my models.
Problem is, Sequelize for some…

יוני ארליך
- 77
- 7
1
vote
1 answer
Return only desired columns from Sequelize.js with join
I am switching from using node-mssql to Sequelize in order to access my database in a simpler fashion. As a newbie to sequelize I am stumbling my way through pulling the correct data.
As I am converting a .net site with .net authentication to a…

Geoff
- 353
- 3
- 19
1
vote
1 answer
The models in ES6 created by sequelize-auto do not work
I generated the models of a MariaDB database by doing:
npx sequelize-auto -o "./models" -l es6 -d databaseName -h 127.0.0.1 -u 'user' -x 'pass'
The output of one of the models is as follows:
import _sequelize from 'sequelize';
const { Model,…

Gonzalo
- 349
- 2
- 5
- 16
1
vote
0 answers
Foreign key save in table is null Sequelize Postgres Association(Node js)
Sending categoryID from postman, but unable to save in Product table.
/
/ Products Schema
module.exports=(sequelize,DataTypes)=>{
let Products = sequelize.define('Products',{
productName : DataTypes.STRING,
unit :…

Yawar ALI
- 35
- 6
1
vote
1 answer
How to get sequelize -auto to generate autoincrement on model from mysql table?
I have a languages tabel in mysql db where I have an Id that is autoincremented:
CREATE TABLE `languages` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Language` varchar(45) NOT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4…

CodingLittle
- 1,761
- 2
- 17
- 44
1
vote
1 answer
require('../') in a script in the node_modules/.bin
I am trying to figure out how the sequelize auto script works in the node_modules directory of a node project.
The very first statement has me stumped:
var sequelizeAuto = require('../');
I don't understand why or how this works [how can you include…

tjb
- 11,480
- 9
- 70
- 91
1
vote
1 answer
Prevent sequelize to insert timestamp
There are many similar questions, but I already tried most of suggested solutions without luck.
I already have database(mysql) so I skipped model definition and used sequelize-auto (programmatic). The first issue came with deprecated dependencies…

bigless
- 2,849
- 19
- 31