lisk-sdk: Inconsistency in migrations

Expected behavior

N/A

Actual behavior

There are several inconsistency in our migration process:

  • Files 20161016133824_addBroadhashColumnToPeers.sql 20161016133824_addHeightColumnToPeers.sql have same ID, that can result with second migration beign not applied correctly on some nodes. We should change ID of second migration and try to re-execute it if needed (change query to ALTER TABLE "peers" ADD COLUMN IF NOT EXISTS "height" INT;)
  • Query that inserts to migations table have ON CONFLICT DO NOTHING, which is not acceptable, as migration should be only executed (and then inserted) once.
  • After renaming all SQL files to underscore case (in https://github.com/LiskHQ/lisk/pull/1455) - entries in migrations table still contains old migration names for already executed migrations. For consistency entries in database should match new names.
  • We should review migration script if it sorts migrations based on ID ascending and then executes them, because migrations should be executed in strict order.

Steps to reproduce

N/A

Which version(s) does this affect? (Environment, OS, etc…)

1.0.0

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (15 by maintainers)

Commits related to this issue

Most upvoted comments

@4miners Issue now also assigned to you. Please implement remaining inconsistencies as you seen them and submit as a PR.

I don’t think that we should rely on fs.readDir behavior.

You gave a link to some very old, Windows-specific issue. Why do we care about that?

Why not do that as normal migration (with timestamp)?

Could you, please clarify, what you mean by normal migration (with timestamp)?

20161016133825_add_height_column_to_peers.sql should be renamed with timestamp higher than last one

It was renamed into one with higher timestamp, as per the PR. The name changed from 20161016133824_ to 20161016133825_

@karmacoma You posted ahead of me by a second 😄