Skip to content

Commit

Permalink
fix: only migrate fts if on sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed May 16, 2022
1 parent 6692e07 commit 1339bfd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "climate-warehouse",
"version": "0.0.32",
"version": "0.0.33",
"private": true,
"bin": "build/server.js",
"type": "module",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

export default {
async up(queryInterface, Sequelize) {
await Promise.all([
queryInterface.addColumn('projects', 'description', {
type: Sequelize.STRING,
allowNull: true,
}),
await queryInterface.addColumn('projects', 'description', {
type: Sequelize.STRING,
allowNull: true,
});

queryInterface.sequelize.query(`drop table projects_fts;`),
if (queryInterface.sequelize.getDialect() === 'sqlite') {
await Promise.all([
queryInterface.sequelize.query(`drop table projects_fts;`),

queryInterface.sequelize.query(`
queryInterface.sequelize.query(`
CREATE VIRTUAL TABLE projects_fts USING fts5(
warehouseProjectId,
orgUid,
Expand All @@ -37,16 +38,17 @@ export default {
description
);
`),
]);
]);
}
},

async down(queryInterface) {
await Promise.all([
queryInterface.removeColumn('projects', 'description'),
await queryInterface.removeColumn('projects', 'description');
if (queryInterface.sequelize.getDialect() === 'sqlite') {
await Promise.all([
queryInterface.sequelize.query(`drop table projects_fts;`),

queryInterface.sequelize.query(`drop table projects_fts;`),

queryInterface.sequelize.query(`
queryInterface.sequelize.query(`
CREATE VIRTUAL TABLE projects_fts USING fts5(
warehouseProjectId,
orgUid,
Expand All @@ -72,6 +74,7 @@ export default {
timeStaged
);
`),
]);
]);
}
},
};

0 comments on commit 1339bfd

Please sign in to comment.