﻿if not Exists(SELECT * FROM information_schema.tables where Table_name = 'KalaSerial')
begin
	create table dbo.KalaSerial
	(
		ID	int primary key,
		Mat_ID	bigint references dbo.Matter(ID) not null,
		Kal_ID	int references dbo.Kala(ID) not null,
		Serial	nvarchar(200) not null,
		Taf_ID	bigint references dbo.Tafsili(ID) null, -- شرکت گارنتی کننده یا نماینده تحویل گیرنده
		Pin1	nvarchar(200) null, -- شماره پین 1
		Pin2	nvarchar(200) null, -- شماره پین 2
		StartDate	int null, -- تاریخ شروع گارنتی
		WarrantyDays	int null, -- تعداد روز گارانتی
		Dom_ID_Status	int references dbo.Domain(ID) not null, -- موجود، استفاده شده، در دست نمایندگی، ...
		[Guid]	nvarchar(max) null, -- هش سریال - واسه خودمون
		[Description]	nvarchar(max) null
	)
end