Back to Sequelize

Function

static/v5/function/index.html

latest2.5 KB
Original Source

Function

| Static Public Summary | | public |

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

Describe a table structure

| |

Static Public

publicdescribeTable(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> |