* 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)
| 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, |
no outgoing calls
no test coverage detected