Skip to content

Commit

Permalink
updated sql server scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Feb 1, 2015
1 parent e87ef33 commit 71294d3
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 106 deletions.
Expand Up @@ -4,16 +4,18 @@ IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'm_org_inc
DROP TABLE m_org_incorrect;

CREATE TABLE m_org_closure (
descendant_oid NVARCHAR(36) COLLATE database_default NOT NULL,
ancestor_oid NVARCHAR(36) COLLATE database_default NOT NULL,
val INT NOT NULL,
PRIMARY KEY (descendant_oid, ancestor_oid)
descendant_oid NVARCHAR(36) COLLATE database_default NOT NULL,
val INT,
PRIMARY KEY (ancestor_oid, descendant_oid)
);

CREATE INDEX iAncestor ON m_org_closure (ancestor_oid);

CREATE INDEX iDescendant ON m_org_closure (descendant_oid);

CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid);

ALTER TABLE m_org_closure
ADD CONSTRAINT fk_ancestor
FOREIGN KEY (ancestor_oid)
Expand Down

0 comments on commit 71294d3

Please sign in to comment.