Drops database table on ESLint restart

This issue has been tracked since 2022-09-28.

Describe the bug
SafeQL executes the queries each time the ESLint is restarted which causes an unexpected dropping of the database table and leads to the error Internal error: relation "animals" does not exist immediately after restarting the ESLint.

To Reproduce
Steps to reproduce the behavior:
It executes the queries below.
e.g

exports.up = async (sql) => {
  await sql`
    CREATE TABLE animals (
      id integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
    )
  `;
};

exports.down = async (sql) => {
  await sql`
    DROP TABLE animals
  `;
};

restart ESLint: cmd + shift + P => ESLint: Restart ESLint Server
Screenshot 2022-09-28 at 10 17 27

Expected behavior
Should not execute any SQL queries

Screenshots
If applicable, add screenshots to help explain your problem.
Before restarting the ESLint
Screenshot 2022-09-28 at 10 06 21
Screenshot 2022-09-28 at 10 06 54

After restarting the ESLint
Screenshot 2022-09-28 at 10 03 56
Screenshot 2022-09-28 at 10 05 06

Desktop (please complete the following information):

  • OS: macOS
  • PostgreSQL version 14
  • Version [e.g. 22]

Additional context
As far as i can tell, SafeQL tries to avoid executing the query by using `sql``.describe()

.describe() should not execute the query according to Postgres.js

But it seems SafeQL is actually executing the query for DROP TABLE which is a big problem

Newbie012 wrote this answer on 2022-10-17

Fixed in 0.0.15

More Details About Repo
Owner Name ts-safeql
Repo Name safeql
Full Name ts-safeql/safeql
Language TypeScript
Created Date 2022-09-08
Updated Date 2023-03-16
Star Count 795
Watcher Count 5
Fork Count 14
Issue Count 7

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date