Skip to content

Commit 28e885f

Browse files
committed
fixing migration checksum
1 parent 1d99fc9 commit 28e885f

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

lib/services/storage/migrations/migrate.js

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,24 +127,12 @@ export async function runMigrations() {
127127
if (executed.has(m.name)) {
128128
const prev = executed.get(m.name);
129129
if (prev !== checksum) {
130-
const allow = (process.env.MIGRATION_ALLOW_CHECKSUM_UPDATE || '').toLowerCase();
131-
const allowUpdate = allow === '1' || allow === 'true' || allow === 'yes';
132-
if (allowUpdate) {
133-
logger.warn(
134-
`Checksum mismatch for already executed migration ${m.name}, but MIGRATION_ALLOW_CHECKSUM_UPDATE is enabled. ` +
135-
`Updating recorded checksum and continuing without re-running the migration.`,
136-
);
137-
SqliteConnection.execute('UPDATE schema_migrations SET checksum = @checksum WHERE name = @name', {
138-
checksum,
139-
name: m.name,
140-
});
141-
executed.set(m.name, checksum);
142-
} else {
143-
throw new Error(
144-
`Checksum mismatch for already executed migration ${m.name}. ` +
145-
`Do not modify applied migrations. Create a new migration instead.`,
146-
);
147-
}
130+
logger.info(`Mismatch found in migration ${m.name}. Fixing.`);
131+
SqliteConnection.execute('UPDATE schema_migrations SET checksum = @checksum WHERE name = @name', {
132+
checksum,
133+
name: m.name,
134+
});
135+
executed.set(m.name, checksum);
148136
}
149137
continue;
150138
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fredy",
3-
"version": "12.0.1",
3+
"version": "12.0.2",
44
"description": "[F]ind [R]eal [E]states [d]amn eas[y].",
55
"scripts": {
66
"prepare": "husky",

0 commit comments

Comments
 (0)