Page MenuHomePhabricator

Changing the `models` does not reflect back to database
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Navigate to ./server/models/Video.js or Settings.js/User.js
  • Add/Remove the properties/columns of the model

What happens?:

You will be encountered an error "<new property name> column does not exist in <model name> Table".
Simply putting, the change is not reflected back to the database

What should have happened instead?:

It should have been reflected to the database. like dropping the existing table and creating a new one with updated columns.

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):
Tool name: VideoCutTool

Possible Solutions

  • Currently for development purposes we can pass a flag force:true to the sync function of the models, which basically recreates the table. This can be a temporary solution, and have been implemented for the time being.
  • A more efficient, permanent, production-ready solution to this can be to create models using Sequelize Migrations.

Note: This task is created as a part of Google Summer Of Code 2023 program.