-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f99644
commit d33f711
Showing
4 changed files
with
23 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
import { DataTypes, QueryInterface } from 'sequelize' | ||
import log from 'electron-log' | ||
|
||
export const migration0001 = { | ||
name: '0001-add_notes_column_to_entry', | ||
up: async ({ context }: { context: QueryInterface }): Promise<void> => { | ||
await context.addColumn('entry', 'notes', { | ||
type: DataTypes.STRING, | ||
allowNull: true | ||
await context.describeTable('entry').then(async (value) => { | ||
if (value.notes) { | ||
log.info('notes column is already exists') | ||
return Promise.resolve() | ||
} | ||
|
||
await context.addColumn('entry', 'notes', { | ||
type: DataTypes.STRING, | ||
allowNull: true | ||
}) | ||
}) | ||
}, | ||
down: async ({ context }): Promise<void> => { | ||
await context.removeColumn('entry', 'notes') | ||
} | ||
down: async (): Promise<void> => {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters