-- Tables
/***** Object:  Table [dbo].[T_PLAN_REQUEST_ATTACHMENT_FILE] *****/
CREATE TABLE [dbo].[T_PLAN_REQUEST_ATTACHMENT_FILE]
(
[PlanRequestAttachmentFileID] uniqueidentifier NULL,
        [PlanRequest] uniqueidentifier NOT NULL,
        [Creator] uniqueidentifier NOT NULL,
        [CreationDateTime] datetime NOT NULL,
        [FileID] uniqueidentifier NOT NULL
) ON [PRIMARY]
GO
        
-- Alters
ALTER TABLE [dbo].[T_PLAN_REQUEST_ATTACHMENT_FILE] WITH NOCHECK ADD CONSTRAINT [PK_T_PLAN_REQUEST_ATTACHMENT_FILE]
PRIMARY KEY CLUSTERED ([FileID]) ON [PRIMARY]
GO
          
ALTER TABLE [dbo].[T_PLAN_REQUEST_ATTACHMENT_FILE] WITH NOCHECK ADD CONSTRAINT [FK_T_PLAN_REQUEST_T_PLAN_REQUEST_ATTACHMENT_FILE_PLANREQUEST] FOREIGN KEY([PlanRequest])
REFERENCES [dbo].[T_PLAN_REQUEST] ([PlanID])
GO
ALTER TABLE [dbo].[T_PLAN_REQUEST_ATTACHMENT_FILE] WITH NOCHECK ADD CONSTRAINT [FK_T_USERS_T_PLAN_REQUEST_ATTACHMENT_FILE_CREATOR] FOREIGN KEY([Creator])
REFERENCES [dbo].[T_USERS] ([UserID])
GO
ALTER TABLE [dbo].[T_PLAN_REQUEST_ATTACHMENT_FILE] WITH NOCHECK ADD CONSTRAINT [FK_T_FILE_T_PLAN_REQUEST_ATTACHMENT_FILE_FILEID] FOREIGN KEY([FileID])
REFERENCES [dbo].[T_FILE] ([FileID])
GO