image optimization. Image resizing client side, index added to db, pagination
This commit is contained in:
20
backend/migrations/20251230000001-add-geospatial-index.js
Normal file
20
backend/migrations/20251230000001-add-geospatial-index.js
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
/** @type {import('sequelize-cli').Migration} */
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
// Add index on latitude and longitude columns for faster geospatial queries
|
||||
// This improves performance of the bounding box pre-filter used in radius searches
|
||||
await queryInterface.addIndex('Items', ['latitude', 'longitude'], {
|
||||
name: 'idx_items_lat_lng',
|
||||
where: {
|
||||
latitude: { [Sequelize.Op.ne]: null },
|
||||
longitude: { [Sequelize.Op.ne]: null }
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
async down(queryInterface, Sequelize) {
|
||||
await queryInterface.removeIndex('Items', 'idx_items_lat_lng');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user