﻿CREATE TABLE [dbo].[ClientPricing] (
    [Id]           UNIQUEIDENTIFIER CONSTRAINT [DF_ClientPricing_Id2] DEFAULT (newid()) NOT NULL,
    [ClientID]     UNIQUEIDENTIFIER NOT NULL,
    [UserTypeID]   UNIQUEIDENTIFIER NOT NULL,
    [RateID]       UNIQUEIDENTIFIER NOT NULL,
    [MaxUsers]     INT              NOT NULL,
    [CurrentUsers] INT              NOT NULL,
    [IsActive]     BIT              NOT NULL,
    CONSTRAINT [PK_ClientPricing] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_ClientPricing_ClientInformation] FOREIGN KEY ([ClientID]) REFERENCES [dbo].[ClientInformation] ([Id]),
    CONSTRAINT [FK_ClientPricing_ClientPricing] FOREIGN KEY ([Id]) REFERENCES [dbo].[ClientPricing] ([Id]),
    CONSTRAINT [FK_ClientPricing_Rate] FOREIGN KEY ([RateID]) REFERENCES [dbo].[Rate] ([Id]),
    CONSTRAINT [FK_ClientPricing_UserType] FOREIGN KEY ([UserTypeID]) REFERENCES [dbo].[UserType] ([Id])
);




GO



GO



GO



GO



GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Max number of users that a client can create', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ClientPricing', @level2type = N'COLUMN', @level2name = N'MaxUsers';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Current count of users created by the client.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ClientPricing', @level2type = N'COLUMN', @level2name = N'CurrentUsers';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Determines if the ClientPricing record is active or inactive(true=active).', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ClientPricing', @level2type = N'COLUMN', @level2name = N'IsActive';

