MCPcopy
hub / github.com/sequelize/sequelize / schema

Method schema

lib/model.js:1425–1441  ·  view source on GitHub ↗

* Apply a schema to this model. For postgres, this will actually place the schema in front of the table name - `"schema"."tableName"`, * while the schema will be prepended to the table name for mysql and sqlite - `'schema.tablename'`. * * This method is intended for use cases where the same

(schema, options)

Source from the content-addressed store, hash-verified

1423 * @returns {Model}
1424 */
1425 static schema(schema, options) {
1426
1427 const clone = class extends this {};
1428 Object.defineProperty(clone, 'name', { value: this.name });
1429
1430 clone._schema = schema;
1431
1432 if (options) {
1433 if (typeof options === 'string') {
1434 clone._schemaDelimiter = options;
1435 } else if (options.schemaDelimiter) {
1436 clone._schemaDelimiter = options.schemaDelimiter;
1437 }
1438 }
1439
1440 return clone;
1441 }
1442
1443 /**
1444 * Get the table name of the model, taking schema into account. The method will return The name as a string if the model has no schema,

Callers 12

getMethod · 0.80
getMethod · 0.80
getMethod · 0.80
getMethod · 0.80
model.test.jsFile · 0.80
has-one.test.jsFile · 0.80
has-many.test.jsFile · 0.80
belongs-to.test.jsFile · 0.80
schema.test.jsFile · 0.80
schema.test.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected