-- 1.0.34 Power.TechnologicalConnection
-- Таблица для хранения файлов.
CREATE TABLE StoreDocuments
(
	DocumentID			int IDENTITY(1,1),
	DocumentName		nvarchar(250),
	AddDate				datetime,
	Binaries			image,
	PRIMARY KEY	(DocumentID)
)
-- Связь с разграничением
CREATE TABLE DelineationDocuments
(
	DocumentID		int,
	DelineationID	int,
	PRIMARY KEY	(DocumentID)	
)
ALTER TABLE DelineationDocuments
        ADD FOREIGN KEY (DocumentID)
            REFERENCES StoreDocuments
            ON DELETE CASCADE
ALTER TABLE DelineationDocuments
	ADD FOREIGN KEY (DelineationID)
            REFERENCES Delineations	
			ON DELETE CASCADE