veramo icon indicating copy to clipboard operation
veramo copied to clipboard

Migrations fail on new install

Open ClearflySystems opened this issue 2 years ago • 3 comments

Bug severity 3

Describe the bug Migrations fail to execute due to missing table 'PreMigrationKey'

To Reproduce Create new DataSource using dbOptions set to use migrations from /data-store and migrationsRun:true. And initialize();

Observed behaviour 2.SimplifyRelations fails at line 16 - migrationGetExistingTableByName(queryRunner, 'PreMigrationKey', true) throws error as table does not exist.

Expected behaviour Exepect migrations to run and DB tables to be created.

Versions (please complete the following information):

  • Veramo: 5.5.4 (@veramo/data-store": "^5.5.4-next.25)
  • Browser Chrome and Firefox
  • Node Version 18

ClearflySystems avatar Dec 07 '23 15:12 ClearflySystems

Any updates on this issue?

Mozartted avatar Feb 07 '25 09:02 Mozartted

I wasn't able to reproduce the issue. Can you provide a minimal project where this problem manifests?

mirceanis avatar Feb 10 '25 16:02 mirceanis

We also experienced this issue. Specifically, an error occurs in our production build (NEXT.js, implementing Veramo version 6.0.0).

The issue, as far as I can tell - at least in our case - occurs as a result of the minifying of code resulting in abbreviated classnames, which are then used in the database schemas.

This is perhaps better explained through the use of the below visuals, whereby we print the keys in the database appear as follows:

Production Build (Minified Build) Image

Development Build (no minifying of code) Image

The screenshot with the list of truncated keys occurs in where the build is in production (and webpack is minifying the build output).

In NEXT.js for example, you can disable minifying the output bundle as follows:

// next.config.js

const nextConfig = {
  ...yourExistingConfigSettings,
  webpack: (config, { dev }) => {
    if (!dev) config.optimization.minimize = false;
    return config;
  },
};

I hope this helps.

radleylewis avatar Apr 09 '25 09:04 radleylewis