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:

Name Type Attribute Description
qi QueryInterface
tableName string

table name

options Object
  • optional

Query options

Return:

Promise<Object>

Copyright © 2014–present Sequelize contributors
Licensed under the MIT License.
https://sequelize.org/v5/function/index.html