diff --git a/README.md b/README.md index d450eeb..c1bbe12 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,4 @@ meta-model. If you modified the generator and want to re-generate the meta-model, you have to: 1. Ensure that no more instances of the meta-model exist in the system. -2. Run `FmxNewSQLMetamodelGenerator class>>#regenerateMetaModel` +2. Run `FmxSQLMetamodelGenerator generate.` diff --git a/src/FAMIXNGSQLMetamodelGenerator/FmxSQLStructuralMetamodelGenerator.class.st b/src/FAMIXNGSQLMetamodelGenerator/FmxSQLStructuralMetamodelGenerator.class.st index cc60f92..03e366c 100644 --- a/src/FAMIXNGSQLMetamodelGenerator/FmxSQLStructuralMetamodelGenerator.class.st +++ b/src/FAMIXNGSQLMetamodelGenerator/FmxSQLStructuralMetamodelGenerator.class.st @@ -24,7 +24,8 @@ Class { 'tWithColumnReference', 'tWithTableReference', 'namespaceReference', - 'tWithNamespaceReference' + 'tWithNamespaceReference', + 'exclusionConstraint' ], #category : #FAMIXNGSQLMetamodelGenerator } @@ -107,6 +108,11 @@ FmxSQLStructuralMetamodelGenerator >> defineStructuralEntities [ newClassNamed: #CheckConstraint comment: self checkConstraintComment. checkConstraint withTesting. + exclusionConstraint := builder + newClassNamed: #ExclusionConstraint + comment: self exclusionConstraintComment. + exclusionConstraint withTesting. + primaryKeyConstraint := builder newClassNamed: #PrimaryKeyConstraint comment: self primaryKeyConstraintComment. @@ -181,6 +187,8 @@ FmxSQLStructuralMetamodelGenerator >> defineStructuralHierarchy [ type --|> structuralEntity. type --|> tAbstractType. + checkConstraint --|> constraint. + exclusionConstraint --|> constraint. primaryKeyConstraint --|> constraint. foreignKeyConstraint --|> constraint. notNullConstraint --|> constraint. @@ -261,6 +269,11 @@ FmxSQLStructuralMetamodelGenerator >> entityInNamespaceComment [ ^ 'I am a trait that any entity which can be part of a namespace use.' ] +{ #category : #'comments - SQL' } +FmxSQLStructuralMetamodelGenerator >> exclusionConstraintComment [ + ^ 'I represent an EXCLUSION constraint as defined in SQL standard.' +] + { #category : #'comments - SQL' } FmxSQLStructuralMetamodelGenerator >> foreignKeyConstraintComment [ ^ 'I represent a FOREIGN KEY constraint as defined in SQL standard.' diff --git a/src/FamixNGSQL/FmxSQLEntity.class.st b/src/FamixNGSQL/FmxSQLEntity.class.st index 9aaf79e..48ab4cd 100644 --- a/src/FamixNGSQL/FmxSQLEntity.class.st +++ b/src/FamixNGSQL/FmxSQLEntity.class.st @@ -102,6 +102,13 @@ FmxSQLEntity >> isExceptClause [ ^ false ] +{ #category : #testing } +FmxSQLEntity >> isExclusionConstraint [ + + + ^ false +] + { #category : #testing } FmxSQLEntity >> isForeignKey [ self deprecated: 'Use #isForeignKeyConstraint instead.' transformWith: '`@receiver isForeignKey' -> '`@receiver isForeignKeyConstraint'. diff --git a/src/FamixNGSQL/FmxSQLExclusionConstraint.class.st b/src/FamixNGSQL/FmxSQLExclusionConstraint.class.st new file mode 100644 index 0000000..cfbe005 --- /dev/null +++ b/src/FamixNGSQL/FmxSQLExclusionConstraint.class.st @@ -0,0 +1,24 @@ +" +I represent a EXCLUSION constraint as defined in SQL standard. +" +Class { + #name : #FmxSQLExclusionConstraint, + #superclass : #FmxSQLConstraint, + #category : #'FamixNGSQL-Entities' +} + +{ #category : #meta } +FmxSQLExclusionConstraint class >> annotation [ + + + + + ^self +] + +{ #category : #testing } +FmxSQLExclusionConstraint >> isExclusionConstraint [ + + + ^ true +] diff --git a/src/FamixNGSQL/FmxSQLTable.class.st b/src/FamixNGSQL/FmxSQLTable.class.st index eff41a8..1b8a1bd 100644 --- a/src/FamixNGSQL/FmxSQLTable.class.st +++ b/src/FamixNGSQL/FmxSQLTable.class.st @@ -87,6 +87,11 @@ FmxSQLTable >> constraintsSatisfying: aBlock [ ^ self constraints select: aBlock ] +{ #category : #accessing } +FmxSQLTable >> exclusionConstraints [ + ^ self constraintsSatisfying: [ :c | c class = FmxSQLExclusionConstraint ] +] + { #category : #accessing } FmxSQLTable >> foreignKeyConstraints [ ^ self constraintsSatisfying: [ :c | c class = FmxSQLForeignKeyConstraint ]