CREATE TABLE [dbo].[QuickBooksSetup]
(
[QuickBooksSetupID] [int] NOT NULL,
[AppName] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[QuickBooksUrl] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CompanyID] [varchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CustomerRefreshDate] [datetime] NULL,
[VendorRefreshDate] [datetime] NULL,
[RevenueItemRefreshDate] [datetime] NULL,
[ExpenseAccountRefreshDate] [datetime] NULL,
[DateModified] [datetime] NOT NULL,
[ModifiedBySysUserFID] [int] NOT NULL,
[ClientID] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ClientSecret] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CsrfKey] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[AuthorizationCode] [varchar] (512) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[AuthorizationObtained] [datetime] NULL,
[OAuth2RefreshToken] [varchar] (512) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[OAuth2RefreshUtcExpiry] [datetime] NULL,
[IsSandboxQbDb] [bit] NOT NULL CONSTRAINT [DF_QuickBooksSetup_IsSandboxQbDb] DEFAULT ((0)),
[ConnectionDisconnectedDate] [datetime] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[QuickBooksSetup] ADD CONSTRAINT [CK_QuickBooksSetupID] CHECK (([QuickBooksSetupID]=(1)))
GO
ALTER TABLE [dbo].[QuickBooksSetup] ADD CONSTRAINT [PK_QuickBooksSetup] PRIMARY KEY NONCLUSTERED ([QuickBooksSetupID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[QuickBooksSetup] ADD CONSTRAINT [FK_QuickBooksSetup_Sysuser] FOREIGN KEY ([ModifiedBySysUserFID]) REFERENCES [dbo].[Sysuser] ([SysUserID])
GO
GRANT SELECT ON [dbo].[QuickBooksSetup] TO [MssExec]
GRANT INSERT ON [dbo].[QuickBooksSetup] TO [MssExec]
GRANT DELETE ON [dbo].[QuickBooksSetup] TO [MssExec]
GRANT UPDATE ON [dbo].[QuickBooksSetup] TO [MssExec]
GO