SQLiteQueryInterface
Extends:
The interface that Sequelize uses to talk with SQLite database
Method Summary
| Public Methods | ||
| public | async addConstraint(tableName: *, options: *) | |
| public | async changeColumn(tableName: *, attributeName: *, dataTypeOrOptions: *, options: *) A wrapper that fixes SQLite's inability to change columns from existing tables. It will create a backup of the table, drop the table afterwards and create a new table with the same name but with a modified version of the respective column. | |
| public | async describeTable(tableName: *, options: *): * | |
| public | async dropAllTables(options: *) | |
| public | async getForeignKeyReferencesForTable(tableName: *, options: *): * | |
| public | async removeColumn(tableName: *, attributeName: *, options: *) A wrapper that fixes SQLite's inability to remove columns from existing tables. It will create a backup of the table, drop the table afterwards and create a new table with the same name but without the obsolete column. | |
| public | async removeConstraint(tableName: *, constraintName: *, options: *) | |
| public | async renameColumn(tableName: *, attrNameBefore: *, attrNameAfter: *, options: *) A wrapper that fixes SQLite's inability to rename columns from existing tables. It will create a backup of the table, drop the table afterwards and create a new table with the same name but with a renamed version of the respective column. | |
Inherited Summary
| From class QueryInterface | ||
| public | Add a new column to a table | |
| public | async addConstraint(tableName: string, options: object): Promise Add a constraint to a table | |
| public | async addIndex(tableName: string | object, attributes: Array, options: object, rawTablename: string): Promise Add an index to a column | |
| public | Delete multiple records from a table | |
| public | Insert multiple records into a table | |
| public | async bulkUpdate(tableName: string, values: object, identifier: object, options: object, attributes: object): Promise Update multiple records of a table | |
| public | async changeColumn(tableName: string, attributeName: string, dataTypeOrOptions: object, options: object): * Change a column definition | |
| public | async createDatabase(database: string, options: object): Promise Create a database | |
| public | async createFunction(functionName: string, params: Array, returnType: string, language: string, body: string, optionsArray: Array, options: object): Promise Create an SQL function | |
| public | async createSchema(schema: string, options: object): Promise Create a schema | |
| public | Create a table with given set of attributes | |
| public | async describeTable(tableName: string, options: object): Promise<object> Describe a table structure | |
| public | async dropAllSchemas(options: object): Promise Drop all schemas | |
| public | async dropAllTables(options: object): Promise Drop all tables from database | |
| public | async dropDatabase(database: string, options: object): Promise Drop a database | |
| public | async dropFunction(functionName: string, params: Array, options: object): Promise Drop an SQL function | |
| public | async dropSchema(schema: string, options: object): Promise Drop a schema | |
| public | Drop a table from database | |
| public | async getForeignKeyReferencesForTable(tableName: string, options: object): * Get foreign key references details for the table | |
| public | async getForeignKeysForTables(tableNames: string[], options: object): Promise Returns all foreign key constraints of requested tables | |
| public | quoteIdentifier(identifier: string, force: boolean): string Split a list of identifiers by "." and quote each part | |
| public | quoteIdentifiers(identifiers: string): string Split a list of identifiers by "." and quote each part. | |
| public | async removeColumn(tableName: string, attributeName: string, options: object): * Remove a column from a table | |
| public | async removeConstraint(tableName: string, constraintName: string, options: object): * Remove a constraint from a table | |
| public | async removeIndex(tableName: string, indexNameOrAttributes: string | string[], options: object): Promise Remove an already existing index from a table | |
| public | async renameColumn(tableName: string, attrNameBefore: string, attrNameAfter: string, options: object): Promise Rename a column | |
| public | async renameFunction(oldFunctionName: string, params: Array, newFunctionName: string, options: object): Promise Rename an SQL function | |
| public | async renameTable(before: string, after: string, options: object): Promise Rename a table | |
| public | async showAllSchemas(options: object): Promise<Array> Show all schemas | |
| public | async tableExists(tableName: TableName, options: QueryOptions): Promise<boolean> Returns a promise that will resolve to true if the table exists in the database, false otherwise. | |
| public | async upsert(tableName: string, insertValues: object, updateValues: object, where: object, options: object): Promise<boolean, ?number> Upsert | |
Public Methods
public async addConstraint(tableName: *, options: *) source
Add a constraint to a table
Available constraints:
- UNIQUE
- DEFAULT (MSSQL only)
- CHECK (MySQL - Ignored by the database engine )
- FOREIGN KEY
- PRIMARY KEY
Override:
QueryInterface#addConstraintParams:
| Name | Type | Attribute | Description | 
| tableName | * | ||
| options | * | 
public async changeColumn(tableName: *, attributeName: *, dataTypeOrOptions: *, options: *) source
A wrapper that fixes SQLite's inability to change columns from existing tables. It will create a backup of the table, drop the table afterwards and create a new table with the same name but with a modified version of the respective column.
Override:
QueryInterface#changeColumnParams:
| Name | Type | Attribute | Description | 
| tableName | * | ||
| attributeName | * | ||
| dataTypeOrOptions | * | ||
| options | * | 
public async describeTable(tableName: *, options: *): * 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
   },
   isBetaMember: {
     type:         'TINYINT(1)', // this will be 'BOOLEAN' for pg!
     allowNull:    false,
     defaultValue: false
   }
}
Override:
QueryInterface#describeTableParams:
| Name | Type | Attribute | Description | 
| tableName | * | ||
| options | * | 
Return:
| * | 
public async dropAllTables(options: *) source
Drop all tables from database
Override:
QueryInterface#dropAllTablesParams:
| Name | Type | Attribute | Description | 
| options | * | 
public async getForeignKeyReferencesForTable(tableName: *, options: *): * source
Get foreign key references details for the table
Those details contains constraintSchema, constraintName, constraintCatalog tableCatalog, tableSchema, tableName, columnName, referencedTableCatalog, referencedTableCatalog, referencedTableSchema, referencedTableName, referencedColumnName. Remind: constraint informations won't return if it's sqlite.
Params:
| Name | Type | Attribute | Description | 
| tableName | * | ||
| options | * | 
Return:
| * | 
public async removeColumn(tableName: *, attributeName: *, options: *) source
A wrapper that fixes SQLite's inability to remove columns from existing tables. It will create a backup of the table, drop the table afterwards and create a new table with the same name but without the obsolete column.
Override:
QueryInterface#removeColumnParams:
| Name | Type | Attribute | Description | 
| tableName | * | ||
| attributeName | * | ||
| options | * | 
public async removeConstraint(tableName: *, constraintName: *, options: *) source
Remove a constraint from a table
Override:
QueryInterface#removeConstraintParams:
| Name | Type | Attribute | Description | 
| tableName | * | ||
| constraintName | * | ||
| options | * | 
public async renameColumn(tableName: *, attrNameBefore: *, attrNameAfter: *, options: *) source
A wrapper that fixes SQLite's inability to rename columns from existing tables. It will create a backup of the table, drop the table afterwards and create a new table with the same name but with a renamed version of the respective column.
Override:
QueryInterface#renameColumnParams:
| Name | Type | Attribute | Description | 
| tableName | * | ||
| attrNameBefore | * | ||
| attrNameAfter | * | ||
| options | * | 
 开发指南
  Reference
  Source
  开发指南
  Reference
  Source
  
   
    
  