Files
legolog/src/database/psql-entity-framework/relationships-constraints.js
Benjamin Kyd d53f7153d8 something
Former-commit-id: b08439f6c37fa171f8f988656eb5bf0bbede8adf
2022-03-25 15:57:12 +00:00

30 lines
661 B
JavaScript

class RelationshipTypes {
static get PRIMARY_KEY() {
return 'PRIMARY KEY';
}
static get UNIQUE() {
return 'UNIQUE';
}
static get NOT_NULL() {
return 'NOT NULL';
}
static get REFERENCES() {
return 'REFERENCES';
}
// NOT a string, ER framework will handle this
static FOREIGN_KEY_REF(references) {
return { fk: { ref: references } };
}
// ONE TO ONE RELATIONSHIP, again ER framework will handle this
static FOREIGN_KEY_121(type, references) {
return { fk: { ref: references }, type, constraints: [this.UNIQUE] };
}
}
module.exports = RelationshipTypes;