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

error: type "string" does not exist #83

Closed
Dan-Homerick-on24 opened this issue Sep 12, 2023 · 3 comments
Closed

error: type "string" does not exist #83

Dan-Homerick-on24 opened this issue Sep 12, 2023 · 3 comments

Comments

@Dan-Homerick-on24
Copy link

Running a migration against postgres v12 or v13[1] fails with the error:
error: type "string" does not exist
that's coming from this bit of code in index.js:

  // we case run_on to string, for dbs that may have bigger precision
  // than miliseconds
  _getKV: function (table, key) {
    var sql =
      `SELECT ${this.escapeDDL('key')},
        ${this.escapeDDL('value')},
        ${this.escapeDDL('run_on')}::STRING // <------ THIS should be ::TEXT
        FROM ` +
      this._escapeDDL +
      table +
      this._escapeDDL +
      ` WHERE ${this.escapeDDL('key')} = $1`;
    return this.allAsync(sql, [key]).then(([row]) => row);
  },

string isn't one of the postgres data types, but text is.

[1] Probably other versions too, those are just the ones I tested.

@wzrdtales
Copy link
Member

thanks for bringing this to our attention. your suggested fix wouldn't fit though. text is not an appropriate replacement for string, we can change it to varchar though

@Dan-Homerick-on24
Copy link
Author

I don't know which database has 'string' as a data type, so I don't know what would be the exact equivalent to it. I expect text would have worked fine, but then again, so would varchar. :)

Thank you for the prompt fix! Do you have an estimate for when you'll make a release incorporating the fix?

@wzrdtales
Copy link
Member

it was done already db-migrate-pg@1.5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants