From 39b287f37e611e317528f7835c939ca349ab9345 Mon Sep 17 00:00:00 2001 From: Dmitry Dorofeev Date: Tue, 29 Jan 2019 23:59:50 +0300 Subject: [PATCH] Added Exlusion constraint as described at https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-EXCLUSION --- .../instance/isExclusionConstraint.st | 3 +++ .../properties.json | 3 +++ .../instance/asFmxSQLEntityIn.withMappingdict..st | 9 +++++++++ .../SqlExclusionConstraint.extension/properties.json | 3 +++ .../FmxSQLExclusionConstraint.class/README.md | 10 ++++++++++ .../class/annotation.st | 7 +++++++ .../class/generatedSlotNames.st | 5 +++++ .../class/generatedTraitNames.st | 4 ++++ .../class/requirements.st | 5 +++++ .../FmxSQLExclusionConstraint.class/properties.json | 11 +++++++++++ 10 files changed, 60 insertions(+) create mode 100644 repository/FamixNGSQL-Extensions.package/FmxSQLExclusionConstraint.extension/instance/isExclusionConstraint.st create mode 100644 repository/FamixNGSQL-Extensions.package/FmxSQLExclusionConstraint.extension/properties.json create mode 100644 repository/FamixNGSQL-Importer.package/SqlExclusionConstraint.extension/instance/asFmxSQLEntityIn.withMappingdict..st create mode 100644 repository/FamixNGSQL-Importer.package/SqlExclusionConstraint.extension/properties.json create mode 100644 repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/README.md create mode 100644 repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/annotation.st create mode 100644 repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/generatedSlotNames.st create mode 100644 repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/generatedTraitNames.st create mode 100644 repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/requirements.st create mode 100644 repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/properties.json diff --git a/repository/FamixNGSQL-Extensions.package/FmxSQLExclusionConstraint.extension/instance/isExclusionConstraint.st b/repository/FamixNGSQL-Extensions.package/FmxSQLExclusionConstraint.extension/instance/isExclusionConstraint.st new file mode 100644 index 00000000..1e44fe7f --- /dev/null +++ b/repository/FamixNGSQL-Extensions.package/FmxSQLExclusionConstraint.extension/instance/isExclusionConstraint.st @@ -0,0 +1,3 @@ +*FamixNGSQL-Extensions +isExclusionConstraint + ^ true \ No newline at end of file diff --git a/repository/FamixNGSQL-Extensions.package/FmxSQLExclusionConstraint.extension/properties.json b/repository/FamixNGSQL-Extensions.package/FmxSQLExclusionConstraint.extension/properties.json new file mode 100644 index 00000000..869ced2b --- /dev/null +++ b/repository/FamixNGSQL-Extensions.package/FmxSQLExclusionConstraint.extension/properties.json @@ -0,0 +1,3 @@ +{ + "name" : "FmxSQLExclusionConstraint" +} \ No newline at end of file diff --git a/repository/FamixNGSQL-Importer.package/SqlExclusionConstraint.extension/instance/asFmxSQLEntityIn.withMappingdict..st b/repository/FamixNGSQL-Importer.package/SqlExclusionConstraint.extension/instance/asFmxSQLEntityIn.withMappingdict..st new file mode 100644 index 00000000..caa4c4e2 --- /dev/null +++ b/repository/FamixNGSQL-Importer.package/SqlExclusionConstraint.extension/instance/asFmxSQLEntityIn.withMappingdict..st @@ -0,0 +1,9 @@ +*FamixNGSQL-Importer +asFmxSQLEntityIn: aMooseModel withMappingdict: pgToFamixEntities + ^ FmxSQLExclusionConstraint new + name: self name; + columns: (self constrainedColumns collect: [ :pgColumn | pgToFamixEntities at: pgColumn ]); + table: (pgToFamixEntities at: self constrainedColumns anyOne) columnsContainer; + source: self code; + mooseModel: aMooseModel; + yourself \ No newline at end of file diff --git a/repository/FamixNGSQL-Importer.package/SqlExclusionConstraint.extension/properties.json b/repository/FamixNGSQL-Importer.package/SqlExclusionConstraint.extension/properties.json new file mode 100644 index 00000000..492b7000 --- /dev/null +++ b/repository/FamixNGSQL-Importer.package/SqlExclusionConstraint.extension/properties.json @@ -0,0 +1,3 @@ +{ + "name" : "SqlExclusionConstraint" +} \ No newline at end of file diff --git a/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/README.md b/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/README.md new file mode 100644 index 00000000..6aa1925f --- /dev/null +++ b/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/README.md @@ -0,0 +1,10 @@ +I represent a EXCLUDE constraint as defined in SQL standard. + +Example: + +ALTER TABLE vcp.attachments +ADD CONSTRAINT unique_vcp_attachment_task_constr +EXCLUDE USING gist (dataset_id WITH =, metric_id WITH =, location_id WITH =, + period_type WITH =, user_id WITH =, assignee_id WITH =, + tstzrange(start_time, expiration_time, '()') WITH &&) +WHERE (attachment_type = 'vcp-task'); \ No newline at end of file diff --git a/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/annotation.st b/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/annotation.st new file mode 100644 index 00000000..24611ee3 --- /dev/null +++ b/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/annotation.st @@ -0,0 +1,7 @@ +meta +annotation + + + + + ^self \ No newline at end of file diff --git a/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/generatedSlotNames.st b/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/generatedSlotNames.st new file mode 100644 index 00000000..0dd42f4a --- /dev/null +++ b/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/generatedSlotNames.st @@ -0,0 +1,5 @@ +generator +generatedSlotNames + + 'FmxSQLExclusionConstraint class>>#generatedSlotNames'. + ^ #() \ No newline at end of file diff --git a/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/generatedTraitNames.st b/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/generatedTraitNames.st new file mode 100644 index 00000000..6d7d0cbf --- /dev/null +++ b/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/generatedTraitNames.st @@ -0,0 +1,4 @@ +generator +generatedTraitNames + + ^ #() \ No newline at end of file diff --git a/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/requirements.st b/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/requirements.st new file mode 100644 index 00000000..49f56ca8 --- /dev/null +++ b/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/class/requirements.st @@ -0,0 +1,5 @@ +meta +requirements + + + ^ { } \ No newline at end of file diff --git a/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/properties.json b/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/properties.json new file mode 100644 index 00000000..25f31f51 --- /dev/null +++ b/repository/FamixNGSQL.package/FmxSQLExclusionConstraint.class/properties.json @@ -0,0 +1,11 @@ +{ + "commentStamp" : "DmitryDorofeev 1/29/2019 23:51", + "super" : "FmxSQLConstraint", + "category" : "FamixNGSQL-Entities", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ ], + "name" : "FmxSQLExclusionConstraint", + "type" : "normal" +} \ No newline at end of file