relational-schema
Advanced tools
Comparing version 0.4.2 to 0.4.3
@@ -17,4 +17,6 @@ "use strict"; | ||
static isOneToOneRelation(table) { | ||
if (table.forwardRelation.type === 'hasOne') | ||
return true; | ||
if (table.forwardRelation.type !== 'belongsTo') | ||
throw new Error('Must give the forward relation'); | ||
throw new Error(`Finding relation cardinality - Expected forward relation of type "belongsTo" but received type "${table.forwardRelation.type}"`); | ||
// check if there is a unique constraint on the join. If so, it is 1 - 1; | ||
@@ -21,0 +23,0 @@ const joinColumns = table.forwardRelation.joins.map((j) => j.fromColumn).sort(); |
@@ -0,1 +1,8 @@ | ||
## [0.4.3](https://github.com/MattGson/relational-schema/compare/v0.4.2...v0.4.3) (2021-05-26) | ||
### Bug Fixes | ||
* **cardinality-resolver:** fixes bug with finding one-to-one relations ([341d4ae](https://github.com/MattGson/relational-schema/commit/341d4ae8ad4debe3ecb2a95c5427ef88336dda4a)) | ||
## [0.4.2](https://github.com/MattGson/relational-schema/compare/v0.4.1...v0.4.2) (2021-05-11) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "relational-schema", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "Generate a js schema for a relational database", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -17,6 +17,2 @@ [![npm](https://img.shields.io/npm/v/relational-schema.svg?style=for-the-badge)](https://www.npmjs.com/package/relational-schema) | ||
Relational-schema is built on top of trusted open-source projects: | ||
- [Knex](https://github.com/knex/knex) | ||
Works with MySQL and PostgreSQL. SQLite coming soon. | ||
@@ -49,3 +45,3 @@ | ||
Create a config file `introspect-config.json` | ||
Create a config file `relation-config.json` | ||
@@ -55,2 +51,3 @@ ```json | ||
"host": "127.0.0.1", | ||
"client": "mysql", | ||
"port": 3306, | ||
@@ -66,3 +63,3 @@ "user": "root", | ||
``` | ||
relational-schema introspect | ||
relations introspect | ||
``` | ||
@@ -603,1 +600,5 @@ | ||
``` | ||
Relational-schema is built on top of trusted open-source projects: | ||
- [Knex](https://github.com/knex/knex) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
149089
1862
600