This PR moves the entire project to Typescript. Due to the ~1000 ignores this will lead to a messy codebase for a while, but the churn is worth it – all of those ignore comments are places that were never type-safe previously. closes #1282
28 lines
641 B
JavaScript
28 lines
641 B
JavaScript
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
const [teams, metaData] = await queryInterface.sequelize.query(
|
|
`SELECT * FROM teams`
|
|
);
|
|
|
|
const teamIds = teams.map((team) => team.id);
|
|
await Promise.all(
|
|
teamIds.map(async (teamId) => {
|
|
await queryInterface.sequelize.query(`
|
|
update users
|
|
set "isAdmin" = true
|
|
where id in (
|
|
select id
|
|
from users
|
|
where "teamId" = '${teamId}'
|
|
order by "createdAt" asc
|
|
limit 1
|
|
);
|
|
`);
|
|
})
|
|
);
|
|
},
|
|
down: async (queryInterface, Sequelize) => {
|
|
// no-op
|
|
},
|
|
};
|