Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

feathers-knex-modeler

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feathers-knex-modeler - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

2

package.json
{
"name": "feathers-knex-modeler",
"version": "1.0.5",
"version": "1.0.6",
"description": "This package allows you to easily extend a table while you are developing it without requiring you to drop tables.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -69,17 +69,26 @@ /* eslint-disable no-console */

}
async hasColumn (tableName, columnName) {
async hasColumn (tableName, columnName, retries = 0) {
const self = this
const db = self.db
tableName = tableName || self.name
let col
if (!_.isUndefined(columnName.name)) {
col = columnName.name
} else {
col = columnName
try {
const db = self.db
tableName = tableName || self.name
let col
if (!_.isUndefined(columnName.name)) {
col = columnName.name
} else {
col = columnName
}
return db.schema.hasColumn(tableName, col)
} catch (err) {
retries++
if (retries > 5) {
throw err
} else {
self.hasColumn(tableName, columnName, retries)
}
}
return db.schema.hasColumn(tableName, col)
}
async waitForColumn (tableName, columnName) {
const self = this
await pWaitFor(() => self.hasColumn(tableName, columnName))
await pWaitFor(async () => self.hasColumn(tableName, columnName))
}

@@ -201,4 +210,4 @@ alterColumn (column, option) {

tableName = tableName || self.name
let hasColumn = await self.hasTable(tableName)
if (hasColumn === false) {
let hasTable = await self.hasTable(tableName)
if (hasTable === false) {
return db.schema.createTable(self.name, function () {

@@ -205,0 +214,0 @@ return true

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc