* 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)
| 1474 | * @returns {Model} |
| 1475 | */ |
| 1476 | static schema(schema, options) { |
| 1477 | |
| 1478 | const clone = class extends this {}; |
| 1479 | Object.defineProperty(clone, 'name', { value: this.name }); |
| 1480 | |
| 1481 | clone._schema = schema; |
| 1482 | |
| 1483 | if (options) { |
| 1484 | if (typeof options === 'string') { |
| 1485 | clone._schemaDelimiter = options; |
| 1486 | } else if (options.schemaDelimiter) { |
| 1487 | clone._schemaDelimiter = options.schemaDelimiter; |
| 1488 | } |
| 1489 | } |
| 1490 | |
| 1491 | return clone; |
| 1492 | } |
| 1493 | |
| 1494 | /** |
| 1495 | * 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