Лабораторная работа: Проектирование РБД "Санатория" с помощью инструментария AllFusion ERwin Data Modeler
ERwinTableDef.Fields.Append ERwinField
ERwinDatabase.TableDefs.Append ERwinTableDef
' CREATE INDEX "PrimaryKey"
Set ERwinTableDef = ERwinDatabase.TableDefs("Worker")
Set ERwinIndex = ERwinTableDef.CreateIndex("PrimaryKey")
Set ERwinField = ERwinIndex.CreateField("ID of worker")
ERwinIndex.Fields.Append ERwinField
Set ERwinField = ERwinIndex.CreateField("ID work place")
ERwinIndex.Fields.Append ERwinField
Set ERwinField = ERwinIndex.CreateField("ID sector")
ERwinIndex.Fields.Append ERwinField
ERwinIndex.Primary = True
ERwinTableDef.Indexes.Append ERwinIndex
' CREATE RELATIONSHIP "Send"
Set ERwinRelation = ERwinDatabase.CreateRelation("Send", "Enterprise-sender", "Client")
Set ERwinField = ERwinRelation.CreateField("ID enterprise")
ERwinField.ForeignName = "ID enterprise"
ERwinRelation.Fields.Append ERwinField
ERwinDatabase.Relations.Append ERwinRelation
' CREATE RELATIONSHIP "Belong to"
Set ERwinRelation = ERwinDatabase.CreateRelation("Belong to", "Housing estate", "Client")
Set ERwinField = ERwinRelation.CreateField("Number of flat")
ERwinField.ForeignName = "Number of flat"
ERwinRelation.Fields.Append ERwinField
ERwinDatabase.Relations.Append ERwinRelation
' CREATE RELATIONSHIP "R/12"
Set ERwinRelation = ERwinDatabase.CreateRelation("R/12", "Client", "Department_Client")
Set ERwinField = ERwinRelation.CreateField("ID client")
ERwinField.ForeignName = "ID client"