﻿CREATE TABLE [dbo].[fuchs_planner_options] (
    [option_id]    INT            NOT NULL,
    [planner_id]   TINYINT        NOT NULL,
    [group_id]     INT            NOT NULL,
    [code]         AS             (([dbo].[ott_b26]([group_id])+'.')+[dbo].[ott_b26]([option_id])),
    [subgroup]     VARCHAR (10)   NULL,
    [option_order] TINYINT        CONSTRAINT [DF_Table_1_item_oder] DEFAULT ((0)) NOT NULL,
    [option_type]  CHAR (1)       NULL,
    [condition]    VARCHAR (100)  NULL,
    [name]         VARCHAR (100)  NULL,
    [description]  VARCHAR (2000) NULL,
    [tooltip]      VARCHAR (500)  NULL,
    [icon_url]     VARCHAR (MAX)  NULL,
    [hide]         BIT            CONSTRAINT [DF_fuchs_planner_options_hide] DEFAULT ((0)) NOT NULL,
    CONSTRAINT [PK_fuchs_planner_options] PRIMARY KEY CLUSTERED ([option_id] ASC),
    CONSTRAINT [FK_fuchs_planner_options_fuchs_planner] FOREIGN KEY ([planner_id]) REFERENCES [dbo].[fuchs_planner] ([planner_id]),
    CONSTRAINT [FK_fuchs_planner_options_fuchs_planner_groups] FOREIGN KEY ([group_id]) REFERENCES [dbo].[fuchs_planner_groups] ([group_id])
);


GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_fuchs_planner_options]
    ON [dbo].[fuchs_planner_options]([planner_id] ASC, [group_id] ASC, [option_order] ASC);

