Questions tagged [sequelize-cli]

The Sequelize Command Line Interface (CLI) supports for migrations and seeders.

The Sequelize Command Line Interface (CLI) supports for migrations and seeders.

With migrations and seeders it's possible to transfer an existing database into another state and vice versa: those state transitions are saved in migration storage and seeder storage accordingly, which describe the way how to get to the new state and how to revert the changes in order to get back to the old state.

Useful links:


Related tags:

499 questions
0
votes
1 answer

Write to Stdout without newline in sequelize migrations

We have a long running migration to run in sequelize that we will run using the migration framework. I'm concerned this migration will cause our CI environment to give up on the job because it cancels jobs if there's no output to the console for a…
ChrisJ
  • 2,486
  • 21
  • 40
0
votes
1 answer

Deploying process nodejs + sequelize on aws beanstalk

I'm using node + sequlize js on aws beanstalk. I've several questions related to deploying process: How to deploy automatically master to beanstalks? should I use some bash script? How to run migration automatically on the production server.…
0
votes
1 answer

How do I write a "belongs to" association which could be from different tables?

How do I write an association for a Model A that belongs to either Model B or Model C but not both? Say I have a Employee Model, Contractor Model, and an Event Model. Associated as follows: Employee has many Events. Contractor has many Events. Event…
HexxNine
  • 446
  • 9
  • 23
0
votes
1 answer

How to connect database with different credential dynamically for different server in production level?

I want to connect the databases which are for the different servers (like dev, staging, live, production). There are different databases and credential for all the server. When a server will be called it will access data only that particular…
0
votes
1 answer

Sequelize Unique Constraint Across Two Tables

I have three tables: survey, survey_owners (join table), users. Surveys naturally have titles and are owned by users. A user can own multiple surveys and a survey can be owned by multiple users (many-to-many relationship). I have the unique…
James
  • 429
  • 1
  • 8
  • 17
0
votes
0 answers

Sequelize fails with permission denied for database, when config property migrationStorageTableSchema is set

I'm using sequelize to run migrations on my DB, the user has all privileges and migrations work well, however it creates SequelizeMeta table in a public schema. When I set schema in the config with migrationStorageTableSchema migrations fail…
0
votes
1 answer

How to use .findAll and find records from two different tables and a self reference?

I'm working with two tables in particular. Users and Friends. Users has a bunch of information that defines the User whereas Friends has two columns aside from id: user_id and friend_id where both of them are a reference to the User table. I'm…
user3026715
  • 404
  • 3
  • 5
  • 19
0
votes
2 answers

Sequelize constraint on delete

I would like to add a constraint inside my migration file, for example when I try and delete a row and there's another row inside another table that's referencing the row i'm deleting it needs to throw an error. There will also be multiple tables…
user990717
  • 470
  • 9
  • 18
0
votes
1 answer

How to implement interface using GraphQL and node

I want to achieve the fields of one object type within another object type Here is my schema file. const Films = new GraphQLInterfaceType({ name: 'films', fields: () => ({ id:{ type: GraphQLID }, name: { type:…
0
votes
1 answer

Is it possible to fetch data from multiple tables using GraphQLList

In GraphQL we can write the object type in GraphQLList and fetch all the fields. I am using Association and it is joining the two tables but I am unable to fetch the field of both the tables. It only takes the fields what I have written in…
0
votes
1 answer

MySql migrations with Sequelize CLI. Cannot add foreign key constraint

I want to migrate this column: countryId: { type: Sequelize.DataTypes.CHAR(2), allowNull: true, references: { model: 'country', key: 'country_code' }, field: 'country_id' }, country_code: countryCode: { type:…
Nikronis
  • 141
  • 2
  • 11
0
votes
1 answer

How to use sequelize migration models when querying?

I have recently switched from "normal" sequelize to migrations with sequelize-cli. Using the cli worked fine so far. But I am unsure how to use the models that are generated. In particular it seems that the way I do it, I have issues with the…
konse
  • 885
  • 1
  • 10
  • 21
0
votes
1 answer

How to use nested include in sequelize with where clause?

I would like to fetch the results of specified college, Exam table has startDate, EndDate, noOfStudents and collage_id. Students table has examId & subject result table has studentId, score and grade. I have tried this below query it returns null…
Schüler
  • 512
  • 4
  • 10
  • 25
0
votes
1 answer

Unhandled rejection SequelizeForeignKeyConstraintError: insert or update on table

I use sequelize-cli for migrations: My migration code: module.exports = { up(queryInterface, Sequelize) { queryInterface.showAllSchemas({ options: {}, }).then((data) => { data.forEach(schema => queryInterface.addColumn({ …
Mohamed Sameer
  • 2,998
  • 3
  • 22
  • 51
0
votes
0 answers

Sequelize Configuration Reading Wrong Dialect

I am working on updating my sequezlie config file so that it runs off env variables when the cli migration command is run. My setup works fine for remote servers that enable the env variables stored, but my local environment (like all) does not…
cphill
  • 5,596
  • 16
  • 89
  • 182