Closed gaylonalfano closed 4 years ago
Hey @gaylonalfano ! Thank you for reporting this bug! I found the issue with the default import, to say it like this: You did everything correctly. I am merging the changes as soon as the pipeline passes, and I will release it under version 1.1.1.
I appreciate the time you spent reporting this!
Your question Hello - Alright, this is slow going for me but I'll get there eventually. I'm pretty sure it's not a bug, so I wanted to first confirm my basic configuration with you. For some reason whenever I try to perform my first
migrate
with a basiccreate_users.ts
migration file, I encounter aTypeError: MigrationClass is not a constructor
(see below).My Basic Config
nessie.config.ts
``` // https://github.com/halvardssm/deno-nessie/blob/master/examples/config-postgres.ts import { ClientOptions, ClientPostgreSQL, } from "https://deno.land/x/nessie/mod.ts"; import type { ConnectionOptions } from "https://deno.land/x/postgres@v0.4.5/connection_params.ts"; import config from "./src/app/config/config.ts"; const clientConfig: ClientOptions = { migrationFolder: "./src/app/db/migrations", seedFolder: "./src/app/db/seeds", experimental: true, }; const connectionConfig: ConnectionOptions = { database: "deno_postgres_db", hostname: "localhost", port: 5432, user: "postgres", password: "postgres", }; export default { /* exposeQueryBuilder: true, */ client: new ClientPostgreSQL(clientConfig, connectionConfig), }; ```create_users.ts
``` import { AbstractMigration, Info } from "https://deno.land/x/nessie/mod.ts"; import type { Client } from "https://deno.land/x/postgres@v0.4.5/mod.ts"; export default class ExperimentalMigration extends AbstractMigrationmigrate -d output (TypeError)
``` ❯ deno-vue-postgres-starter/backend add-nessie [!?] deno run --allow-net --allow-read --allow-write https://deno.land/x/nessie/cli.ts migrate -d State: [ true, "file:///Users/gaylonalfano/Code/deno-vue-postgres-starter/backend/nessie.config.ts" ] Checking config path Amount pre: undefined Latest migrations: undefined Filtered and sorted migration files: [ "1602682202673-create_users.ts" ] TypeError: MigrationClass is not a constructor at ClientPostgreSQL._migrationHandler (AbstractClient.ts:215:25) at async ClientPostgreSQL.migrate (AbstractClient.ts:97:9) at async ClientPostgreSQL.migrate (ClientPostgreSQL.ts:73:5) at async run (https://deno.land/x/nessie@v1.1.2/cli.ts:74:11) ```I looked inside your
AbstractClient.ts
file for theMigrationClass
. Here is a snippet that the error log points to:I've hit a roadblock to be honest. My code attempts to follow your basic examples on the README.md and within your examples folder (experimental only). I create the
ClientPostgeSQL
asclient
inside thenessie.config.ts
. However, I'm not sure whether I need to use/import thisclient
into the migration file or not. No rush. Just trying to get a working basic example before I try to add anything else e.g., Dex (like in your more extensive example).