A modular Deno library for PostgreSQL, MySQL, MariaDB and SQLite migrations
### Operating System Ubuntu 20.04.4 LTS ### Deno version 1.24.0 ### Nessie version 2.0.6 ### Bug description I try to seed the database with some fake data to run integration tests, in the seed file, i try to import the Json file with the data and iterates over the array and save on the database on each value as the code below: ```ts import { AbstractSeed, ClientPostgreSQL, Info } from "../../deps/nessie.ts"; import fakeData from "../../fake_data.json" assert { type: "json" }; const data = fakeData.pdvs; export default class extends AbstractSeed<ClientPostgreSQL> { /** Runs on seed */ async run(info: Info): Promise<void> { for (const value of data) { const savedPartner = await this.client.queryArray( `INSERT INTO partner (trading_name, owner_name, document) VALUES ($1, $2, $3) RETURNING id;`, [ value.tradingName, value.ownerName, value.document, ], ); const partnerId = savedPartner.rows[0][0]; await this.client.queryArray( `INSERT INTO address (type, coordinates, partner_id) VALUES ($1, $2, $3);`, [ value.address.type, value.address.coordinates, partnerId, ], ); await this.client.queryArray( `INSERT INTO coverage_area (type, coordinates, partner_id) VALUES ($1, $2, $3);`, [ value.coverageArea.type, value.coverageArea.coordinates, partnerId, ], ); } } } ``` When i run the seed command, this is the output: ```bash Task seed:run deno run -A --unstable https://deno.land/x/nessie/cli.ts seed Starting seeding of 1 files ---- Seeding populate_partner.ts PostgresError: bind message supplies 1 parameters, but prepared statement "" requires 3 at Connection.#preparedQuery (https://deno.land/x/[email protected]/connection/connection.ts:805:19) at async Connection.query (https://deno.land/x/[email protected]/connection/connection.ts:877:16) at async default.run (file:///home/marcos/Documentos/Projects/deno/ze-code-challenges-backend/db/seeds/populate_partner.ts:10:28) at async ClientPostgreSQL._seed (https://deno.land/x/[email protected]/clients/AbstractClient.ts:199:7) at async ClientPostgreSQL.seed (https://deno.land/x/[email protected]/clients/ClientPostgreSQL.ts:124:5) at async Command.seed [as fn] (https://deno.land/x/[email protected]/cli.ts:239:3) at async Command.execute (https://deno.land/x/[email protected]/command/command.ts:1014:7) at async Command.parse (https://deno.land/x/[email protected]/command/command.ts:928:16) at async cli (https://deno.land/x/[email protected]/cli.ts:51:3) at async run (https://deno.land/x/[email protected]/cli.ts:368:5) This error is most likely unrelated to Nessie, and is probably related to the client, the connection config or the query you are trying to execute. ``` The migrations run command works, but the seed don't. Is my seed code wrong? Maybe is the Json file import that Nessie don't suport. ### Steps to reproduce Steps to reproduce behavior: 1. Import Json file with fake data to seed the database. 2. Iterates over the array to insert in the database. 3. Run seed command. ### Aditional information _No response_
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be resolved. The issue was opened by marcosadriano05 and has received 1 comments.