Open jlechem opened 8 years ago
I found one more proc and 1 more table, this is ridiculous.
CREATE PROCEDURE [dbo].[BugNet_UserCustomField_GetCustomFieldsByUserId] @UserId UNIQUEIDENTIFIER AS
SELECT Fields.CustomFieldId, Fields.CustomFieldName, Fields.CustomFieldDataType, Fields.CustomFieldRequired, ISNULL(CustomFieldValue,'') CustomFieldValue, Fields.CustomFieldTypeId FROM BugNet_UserCustomFields Fields LEFT OUTER JOIN BugNet_UserCustomFieldValues FieldValues ON (Fields.CustomFieldId = FieldValues.CustomFieldId AND FieldValues.UserId = @UserId)
CREATE TABLE [dbo].[BugNet_UserCustomFieldValues]([CustomFieldValueId] INT IDENTITY %281, 1%29 NOT NULL, [UserId] UNIQUEIDENTIFIER NOT NULL, [CustomFieldId] INT NOT NULL, [CustomFieldValue] NVARCHAR %28MAX%29 NOT NULL, CONSTRAINT [PK_BugNet_UserCustomFieldValues] PRIMARY KEY CLUSTERED %28[CustomFieldValueId] ASC%29, CONSTRAINT [FK_BugNet_UserCustomFieldValues_BugNet_Users] FOREIGN KEY %28[UserId]%29 REFERENCES [dbo].[Users] %28[UserId]%29 ON DELETE CASCADE, CONSTRAINT [FK_BugNet_UserCustomFieldValues_BugNet_UserCustomFields] FOREIGN KEY %28[CustomFieldId]%29 REFERENCES [dbo].[BugNet_UserCustomFields] %28[CustomFieldId]%29);
You can find the code for the tables and StoredProcedures here: https://github.com/dubeaud/bugnet/tree/master/src/BugNET.Database
I have done multiple installs of this product using the built in /Install/Install.aspx and have had it run successfully. Then I go in and login with the default admin account and go to create a user and get 3 SQL errors about missing stored procedures and missing tables. I had to add 1 proc and 2 tables.
CREATE PROCEDURE [dbo].[BugNet_UserCustomField_GetCustomFields] AS
SELECT Fields.CustomFieldId, Fields.CustomFieldName, Fields.CustomFieldDataType, Fields.CustomFieldRequired, '' CustomFieldValue, Fields.CustomFieldTypeId FROM BugNet_UserCustomFields Fields
);
CREATE TABLE [dbo].[BugNet_UserCustomFields]([CustomFieldId] INT IDENTITY %281, 1%29 NOT NULL, [CustomFieldName] NVARCHAR %2850%29 NOT NULL, [CustomFieldRequired] BIT NOT NULL, [CustomFieldDataType] INT NOT NULL, [CustomFieldTypeId] INT NOT NULL, CONSTRAINT [PK_BugNet_UserCustomFields] PRIMARY KEY CLUSTERED %28[CustomFieldId] ASC%29, CONSTRAINT [FK_BugNet_UserCustomFields_BugNet_UserCustomFieldType] FOREIGN KEY %28[CustomFieldTypeId]%29 REFERENCES [dbo].[BugNet_UserCustomFieldTypes] %28[CustomFieldTypeId]%29 ON DELETE CASCADE);