IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WareTicket]') AND type in (N'U'))
BEGIN
  CREATE TABLE [dbo].[WareTicket](
	  [WareNumber] [int] NOT NULL,
	  [NameUsed] [bit] NOT NULL,
	  [NameRequired] [bit] NOT NULL,
	  [PhoneUsed] [bit] NOT NULL,
	  [PhoneRequired] [bit] NOT NULL,
	  [ImageUsed] [bit] NOT NULL,
	  [ImageRequired] [bit] NOT NULL,
   CONSTRAINT [PK_WareTicket] PRIMARY KEY CLUSTERED 
  (
	  [WareNumber] ASC
  ) ON [PRIMARY]
  ) ON [PRIMARY]

  ALTER TABLE [dbo].[WareTicket] ADD  CONSTRAINT [DF_WareTicket_NameUsed]  DEFAULT ((0)) FOR [NameUsed]

  ALTER TABLE [dbo].[WareTicket] ADD  CONSTRAINT [DF_WareTicket_NameRequired]  DEFAULT ((0)) FOR [NameRequired]

  ALTER TABLE [dbo].[WareTicket] ADD  CONSTRAINT [DF_WareTicket_PhoneUsed]  DEFAULT ((0)) FOR [PhoneUsed]

  ALTER TABLE [dbo].[WareTicket] ADD  CONSTRAINT [DF_WareTicket_PhoneRequired]  DEFAULT ((0)) FOR [PhoneRequired]

  ALTER TABLE [dbo].[WareTicket] ADD  CONSTRAINT [DF_WareTicket_ImageUsed]  DEFAULT ((0)) FOR [ImageUsed]

  ALTER TABLE [dbo].[WareTicket] ADD  CONSTRAINT [DF_WareTicket_ImageRequired]  DEFAULT ((0)) FOR [ImageRequired]

  ALTER TABLE [dbo].[WareTicket]  WITH CHECK ADD  CONSTRAINT [FK_WareTicket_Ware] FOREIGN KEY([WareNumber])
  REFERENCES [dbo].[Ware] ([WareNumber])
  ON DELETE CASCADE

  ALTER TABLE [dbo].[WareTicket] CHECK CONSTRAINT [FK_WareTicket_Ware]

END
