Skip to content

Commit

Permalink
Fix table name capitalization
Browse files Browse the repository at this point in the history
  • Loading branch information
john-craft committed Nov 15, 2024
1 parent 5655aa2 commit bb21f0f
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
module.exports = {
async up (queryInterface, Sequelize) {
// Add a temporary column
await queryInterface.addColumn('Users', 'dob_temp', {
await queryInterface.addColumn('users', 'dob_temp', {
type: Sequelize.DATEONLY,
});

// Convert and move the data from 'dob' to 'dob_temp'
await queryInterface.sequelize.query(`
UPDATE "Users"
UPDATE "users"
SET "dob_temp" = "dob"::DATE
`);

// Remove the old 'dob' column
await queryInterface.removeColumn('Users', 'dob');
await queryInterface.removeColumn('users', 'dob');

// Rename the 'dob_temp' column to 'dob'
await queryInterface.renameColumn('Users', 'dob_temp', 'dob');
await queryInterface.renameColumn('users', 'dob_temp', 'dob');
},

async down (queryInterface, Sequelize) {
await queryInterface.changeColumn('Users', 'dob', {
await queryInterface.changeColumn('users', 'dob', {
type: Sequelize.STRING,
allowNull: true
});
Expand Down

0 comments on commit bb21f0f

Please sign in to comment.