/***** Object:  Table [dbo].[T_UNITED_OBJECT] *****/
CREATE TABLE [dbo].[T_UNITED_OBJECT](
	[UnitedObjectID] uniqueidentifier NOT NULL,
	[Entities] int NOT NULL,
	[CreateDate] datetime NOT NULL,
	[BaseUsers] uniqueidentifier NOT NULL,
	[ObjectID] varchar(256) NOT NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[T_UNITED_OBJECT] WITH NOCHECK ADD CONSTRAINT [PK_T_UNITED_OBJECT]
PRIMARY KEY CLUSTERED ([UnitedObjectID]) ON [PRIMARY]
GO
        
ALTER TABLE [dbo].[T_UNITED_OBJECT] WITH NOCHECK ADD CONSTRAINT [FK_T_ENTITIES_T_UNITED_OBJECT_ENTITIES] FOREIGN KEY([Entities])
REFERENCES [dbo].[T_ENTITIES] ([EntityID])
GO
ALTER TABLE [dbo].[T_UNITED_OBJECT] WITH NOCHECK ADD CONSTRAINT [FK_T_USERS_T_UNITED_OBJECT_BASEUSERS] FOREIGN KEY([BaseUsers])
REFERENCES [dbo].[T_USERS] ([UserID])
GO

/***** Object:  Table [dbo].[T_UNITED_OBJECT_CHANGESET] *****/
CREATE TABLE [dbo].[T_UNITED_OBJECT_CHANGESET](
	[UnitedObjectChangesetID] uniqueidentifier NOT NULL,
	[UnitedObject] uniqueidentifier NOT NULL,
	[ChangeType] int NOT NULL,
	[ObjectID] varchar(256) NOT NULL,
	[Entities] int NOT NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[T_UNITED_OBJECT_CHANGESET] WITH NOCHECK ADD CONSTRAINT [PK_T_UNITED_OBJECT_CHANGESET]
PRIMARY KEY CLUSTERED ([UnitedObjectChangesetID]) ON [PRIMARY]
GO
        
ALTER TABLE [dbo].[T_UNITED_OBJECT_CHANGESET] WITH NOCHECK ADD CONSTRAINT [FK_T_UNITED_OBJECT_T_UNITED_OBJECT_CHANGESET_UNITEDOBJECT] FOREIGN KEY([UnitedObject])
REFERENCES [dbo].[T_UNITED_OBJECT] ([UnitedObjectID])
GO
ALTER TABLE [dbo].[T_UNITED_OBJECT_CHANGESET] WITH NOCHECK ADD CONSTRAINT [FK_T_ENTITIES_T_UNITED_OBJECT_CHANGESET_ENTITIES] FOREIGN KEY([Entities])
REFERENCES [dbo].[T_ENTITIES] ([EntityID])
GO