API Reference Source

Function

Static Public Summary
public

describeTable(qi: QueryInterface, tableName: string, options: Object): Promise<Object>

Describe a table structure

Static Public

public describeTable(qi: QueryInterface, tableName: string, options: Object): Promise<Object> source

Describe a table structure

This method returns an array of hashes containing information about all attributes in the table.

{
   name: {
     type:         'VARCHAR(255)', // this will be 'CHARACTER VARYING' for pg!
     allowNull:    true,
     defaultValue: null,
     unique:       true,           // available for sqlite only
     references:   {},             // available for sqlite only
   },
   isBetaMember: {
     type:         'TINYINT(1)', // this will be 'BOOLEAN' for pg!
     allowNull:    false,
     defaultValue: false,
     unique:       false,        // available for sqlite only
     references:   {},           // available for sqlite only
   }
}

Params:

NameTypeAttributeDescription
qi QueryInterface
tableName string

table name

options Object
  • optional

Query options

Return:

Promise<Object>