-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #401 from internxt/feat/creation-modification-time…
…s-on-folders [PB-3009]: feat/creation modification times on folders
- Loading branch information
Showing
16 changed files
with
264 additions
and
186 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
migrations/20240927193342-add-modification-creation-times-to-folders.js
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
const tableName = 'folders'; | ||
const newColumn1 = 'creation_time'; | ||
const newColumn2 = 'modification_time'; | ||
|
||
/** @type {import('sequelize-cli').Migration} */ | ||
module.exports = { | ||
async up(queryInterface, Sequelize) { | ||
await queryInterface.addColumn(tableName, newColumn1, { | ||
type: Sequelize.DATE, | ||
defaultValue: Sequelize.fn('NOW'), | ||
allowNull: false, | ||
}); | ||
|
||
await queryInterface.addColumn(tableName, newColumn2, { | ||
type: Sequelize.DATE, | ||
defaultValue: Sequelize.fn('NOW'), | ||
allowNull: false, | ||
}); | ||
}, | ||
|
||
async down(queryInterface) { | ||
await queryInterface.removeColumn(tableName, newColumn1); | ||
await queryInterface.removeColumn(tableName, newColumn2); | ||
}, | ||
}; |
17 changes: 17 additions & 0 deletions
17
migrations/20241002040050-create-modificationtime-index-on-files.js
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
const tableName = 'files'; | ||
const indexName = 'files_modification_time_index'; | ||
|
||
/** @type {import('sequelize-cli').Migration} */ | ||
module.exports = { | ||
async up(queryInterface) { | ||
await queryInterface.sequelize.query( | ||
`CREATE INDEX CONCURRENTLY ${indexName} ON ${tableName} (modification_time);`, | ||
); | ||
}, | ||
|
||
async down(queryInterface) { | ||
await queryInterface.sequelize.query(`DROP INDEX IF EXISTS ${indexName};`); | ||
}, | ||
}; |
17 changes: 17 additions & 0 deletions
17
migrations/20241002044035-create-modificationtime-index-on-folders.js
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
const tableName = 'folders'; | ||
const indexName = 'folders_modification_time_index'; | ||
|
||
/** @type {import('sequelize-cli').Migration} */ | ||
module.exports = { | ||
async up(queryInterface) { | ||
await queryInterface.sequelize.query( | ||
`CREATE INDEX CONCURRENTLY ${indexName} ON ${tableName} (modification_time);`, | ||
); | ||
}, | ||
|
||
async down(queryInterface) { | ||
await queryInterface.sequelize.query(`DROP INDEX IF EXISTS ${indexName};`); | ||
}, | ||
}; |
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
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
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
Oops, something went wrong.