
/****** Object:  Table [dbo].[ApiCustomers]    Script Date: 06.09.2021 19:54:45 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[ApiCustomers](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[CustId] [int] NOT NULL,
	[ErpId] [int] NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
	[Code] [nvarchar](max) NULL,
	[TAXID] [nvarchar](max) NULL,
	[Type] [int] NOT NULL,
	[AdrrZip] [nvarchar](max) NULL,
	[AdrrCity] [nvarchar](max) NULL,
	[AdrrStreet] [nvarchar](max) NULL,
	[AdrrNumber] [nvarchar](max) NULL,
	[AdrrAppNumber] [nvarchar](max) NULL,
	[AdrrCountry] [nvarchar](max) NULL,
	AdrrCountryCode [nvarchar](3) NULL,
	[Phone] [nvarchar](max) NULL,
	[Phone2] [nvarchar](max) NULL,
	[Email] [nvarchar](max) NULL,
	[Notes] [nvarchar](max) NULL,
	[CategoryName] [nvarchar](max) NULL,
	[CategoryId] [int] NOT NULL,
	[Locked] [bit] NOT NULL,
	[payment] [nvarchar](max) NULL,
	[paymentTime] [int] NOT NULL,
	PaymentLimit decimal(16,2) NULL,
	PaymentCurrency nvarchar(10) NULL,
	[vendorId] [int] NOT NULL,
	[EAN] [nvarchar](max) NULL,
	[geolat] [float] NOT NULL,
	[geolong] [float] NOT NULL,
	[LoyaltyScore] [decimal](18, 2) NOT NULL,
	[LoyaltyPasswd] [nvarchar](max) NULL,
	[VendorName] [nvarchar](max) NULL,
	[VendorPhone] [nvarchar](max) NULL,
	[VendorMail] [nvarchar](max) NULL,
	[WWW] [nvarchar](max) NULL,
	[Status] [int] NOT NULL,
	[TS] [datetime] NOT NULL,
	[SaveTS] [int] NOT NULL,
	[DeviceUid] [nvarchar](max) NULL,
	[State] [int] NOT NULL,
	[Discount] [decimal](18, 2) NOT NULL,
	[paymentId] [int] NOT NULL,
	[PriceId] [int] NULL,
	RegionId [int] NULL,
 CONSTRAINT [PK_dbo.ApiCustomers] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[ApiCustomers] ADD  CONSTRAINT [DF_ApiCustomers_paymentId]  DEFAULT ((0)) FOR [paymentId]
GO


