Git Product home page Git Product logo

Comments (3)

michaelbromley avatar michaelbromley commented on July 30, 2024 1

@meyvan non-interactive mode for CLI commands is coming in an upcoming feature release.

from vendure.

jyling avatar jyling commented on July 30, 2024

https://docs.vendure.io/guides/developer-guide/migrations/#3-run-the-migration

Assuming the migration file looks correct, the next time you start the server, 
the migration will be run automatically. This is because the runMigrations 
function is called in the src/index.ts file:

Migration should run automatically when you start the server, unless I misunderstood your issue ?

from vendure.

meyvan avatar meyvan commented on July 30, 2024

Automatically updating the DB schema when server is started is a Anti-DevOps principle. We should be able to control when and how we run the migrations. And for that npx vendure migrate command is good, but it is interactive, which cannot(or hard to achieve) in a Github Actions CI/CD pipeline.

A better option is to send in arguments like --no-interaction combined with --runMigration or other arguments like that

Nevertheless, I found a way to run the migration separately.

And to anyone coming here, at the time of writing, copy the

import {  runMigrations } from '@vendure/core';
import { config } from './vendure-config';

runMigrations(config)
    .then(() => console.log('Migration Complete'))
    .catch(err => {
        console.log(err);
    });

into a separate file and run it using ts-node migrate.ts , whenever and wherever you like

from vendure.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.