Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drizzle migrate function doesn't run #19

Open
jonbiemond opened this issue Nov 24, 2023 · 1 comment
Open

Drizzle migrate function doesn't run #19

jonbiemond opened this issue Nov 24, 2023 · 1 comment
Labels
backend Change to the backend bug Something isn't working

Comments

@jonbiemond
Copy link
Collaborator

Command npm run migrate produces the following error below.
The migrate code is located in src/index.ts.
Some more instructions are here: https://orm.drizzle.team/docs/migrations#run-the-migrations

PS C:\Users\Jonathan\WebstormProjects\pew> npm run migrate               

> migrate
> ts-node src/index.ts

(node:32716) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
C:\Users\Jonathan\WebstormProjects\pew\src\index.ts:1
import { drizzle } from 'drizzle-orm/postgres-js';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1153:20)
    at Module._compile (node:internal/modules/cjs/loader:1205:27)
    at Module.m._compile (C:\Users\Jonathan\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Object.require.extensions.<computed> [as .ts] (C:\Users\Jonathan\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Function.Module._load (node:internal/modules/cjs/loader:938:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at phase4 (C:\Users\Jonathan\AppData\Roaming\npm\node_modules\ts-node\src\bin.ts:649:14)
@jonbiemond jonbiemond added bug Something isn't working backend Change to the backend labels Nov 24, 2023
@jonbiemond
Copy link
Collaborator Author

jonbiemond commented Nov 25, 2023

After commit 808c3fe there is a new error:

PS C:\Users\Jonathan\WebstormProjects\pew> npm run migrate   

> migrate
> ts-node src/index.ts

C:\Users\Jonathan\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:859
    return new TSError(diagnosticText, diagnosticCodes, diagnostics);
           ^
TSError: ⨯ Unable to compile TypeScript:
src/index.ts:12:1 - error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher.

12 await migrate(db, { migrationsFolder: "drizzle" });
   ~~~~~

    at createTSError (C:\Users\Jonathan\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:859:12)
    at reportTSError (C:\Users\Jonathan\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:863:19)
    at getOutput (C:\Users\Jonathan\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1077:36)
    at Object.compile (C:\Users\Jonathan\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1433:41)
    at Module.m._compile (C:\Users\Jonathan\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1617:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Object.require.extensions.<computed> [as .ts] (C:\Users\Jonathan\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Function.Module._load (node:internal/modules/cjs/loader:938:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) {
  diagnosticCodes: [ 1378 ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Change to the backend bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant