Skip to content

Changing multiple columns example #565

Closed
@harishajdarevic

Description

@harishajdarevic

I'm submitting a...

  • Bug report
  • Feature request
  • [X ] Question

Current behavior

I want to change multiple columns in one migration. Could you provide example.

This is what I tried so far:

exports.up = function(db) {
    return [
    db.changeColumn(models.PROJECT_BIM_MODEL_SYNC, 'created_at', {
        type: 'timestamp',
        notNull: true,
        defaultValue: new String('CURRENT_TIMESTAMP')
    }),

    db.changeColumn(models.PROJECT_TABLE, 'updated_at', {
        type: 'timestamp',
        notNull: true,
        defaultValue: new String('CURRENT_TIMESTAMP')
    }),
]
};

and

exports.up = function(db) {

    db.changeColumn(models.PROJECT_BIM_MODEL_SYNC, 'created_at', {
        type: 'timestamp',
        notNull: true,
        defaultValue: new String('CURRENT_TIMESTAMP')
    }),

    db.changeColumn(models.PROJECT_TABLE, 'updated_at', {
        type: 'timestamp',
        notNull: true,
        defaultValue: new String('CURRENT_TIMESTAMP')
    }),

   return null;
};

Expected behavior

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment


db-migrate version: X.Y.Z
plugins with versions: X.Y.Z
db-migrate driver with versions: 

Additional information:
- Node version: XX  
- Platform:  

Others:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions