mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
a411e08f1f
* chore: Address code quality findings * Round 2, quality findings * fix: Add fallback for MediaQueryList.addEventListener in test env The jsdom test environment doesn't implement addEventListener on MediaQueryList. Prefer addEventListener but fall back to the deprecated addListener when unavailable.
36 lines
1011 B
JavaScript
36 lines
1011 B
JavaScript
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
await queryInterface.addColumn("documents", "publishedAt", {
|
|
type: Sequelize.DATE,
|
|
allowNull: true,
|
|
});
|
|
const [documents] = await queryInterface.sequelize.query(
|
|
`SELECT * FROM documents`
|
|
);
|
|
|
|
for (const document of documents) {
|
|
await queryInterface.sequelize.query(`
|
|
update documents
|
|
set "publishedAt" = '${new Date(document.createdAt).toISOString()}'
|
|
where id = '${document.id}'
|
|
`);
|
|
}
|
|
|
|
await queryInterface.removeIndex("documents", ["id", "atlasId"]);
|
|
await queryInterface.addIndex("documents", [
|
|
"id",
|
|
"atlasId",
|
|
"publishedAt",
|
|
]);
|
|
},
|
|
down: async (queryInterface, Sequelize) => {
|
|
await queryInterface.removeColumn("documents", "publishedAt");
|
|
await queryInterface.removeIndex("documents", [
|
|
"id",
|
|
"atlasId",
|
|
"publishedAt",
|
|
]);
|
|
await queryInterface.addIndex("documents", ["id", "atlasId"]);
|
|
},
|
|
};
|