<DB>
	<sql ver="1">
		--初始密码123456
		insert into [dbo].[UserInfo] (id,CreateTime,CreateUserID,CreateUserName,Account,UserName,Sex,DeptID,DeptName,PostID,PostName,WorkNo,CellPhoneNum,TelPhoneNum,Remake,PassWord,IsAdmin,PowerLevel,IsLeaving,IsDelete,CreationTime) values ('816226B1-6FA4-43BB-8BC5-EE41BD521FC3','2020-12-20','816226B1-6FA4-43BB-8BC5-EE41BD521FC3','admin','admin','超级管理员','1','','','','','00000001','17858852533','','超级管理员','4QrcOUm6Wau+VuBX8g+IPg','1','','0','0','2020-12-20');
	</sql>
	<sql ver="2">
		--创建图库列表的视图
		CREATE VIEW ViewGalleryInformation
		AS
		SELECT a.Id,
		a.CreateTime,
		a.CreateUserID,
		a.CreateUserName,
		a.UpdateTime,
		a.UpdateUserID,
		a.UpdateUserName,
		a.GalleryNum,
		a.Remark,
		a.IsDelete,
		a.CreationTime,
		COUNT(b.Id) AS FilesCount
		FROM GalleryInformation AS a
		LEFT JOIN
		(SELECT * FROM GalleryFiles WHERE IsDelete != 1) AS b
		ON a.Id = b.GalleryInformationID
		WHERE a.IsDelete != 1
		GROUP BY a.Id,
		a.CreateTime,
		a.CreateUserID,
		a.CreateUserName,
		a.UpdateTime,
		a.UpdateUserID,
		a.UpdateUserName,
		a.GalleryNum,
		a.Remark,
		a.IsDelete,
		a.CreationTime;
	</sql>
	<sql ver="3">
		create table Version (
		DBVersion            int                  null
		)
		go
	</sql>
	<sql ver="4">
		--初始化数据库版本
		INSERT INTO dbo.Version (DBVersion) VALUES (4);
	</sql>
	<sql ver="5">
		UPDATE dbo.Version SET DBVersion =5;
		
		CREATE TABLE [dbo].[BOM](
		[Id] [UNIQUEIDENTIFIER] NOT NULL,
		[CreateTime] [DATETIME2](7) NULL,
		[CreateUserID] [NVARCHAR](50) NULL,
		[CreateUserName] [NVARCHAR](50) NULL,
		[UpdateTime] [DATETIME2](7) NULL,
		[UpdateUserID] [NVARCHAR](50) NULL,
		[UpdateUserName] [NVARCHAR](50) NULL,
		[DesignAssyNum] [NVARCHAR](MAX) NULL,
		[Name] [NVARCHAR](300) NULL,
		[Remark] [NVARCHAR](300) NULL,
		[IsAnnex] [INT] NOT NULL,
		[IsDelete] [INT] NOT NULL,
		[CreationTime] [DATETIME2](7) NOT NULL,
		CONSTRAINT [PK_BOM] 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

		CREATE TABLE [dbo].[BOMDetails](
		[Id] [UNIQUEIDENTIFIER] NOT NULL,
		[CreateTime] [DATETIME2](7) NULL,
		[CreateUserID] [NVARCHAR](50) NULL,
		[CreateUserName] [NVARCHAR](50) NULL,
		[UpdateTime] [DATETIME2](7) NULL,
		[UpdateUserID] [NVARCHAR](50) NULL,
		[UpdateUserName] [NVARCHAR](50) NULL,
		[BOMID] [NVARCHAR](50) NULL,
		[RelationshipID] [NVARCHAR](50) NULL,
		[RelationshipName] [NVARCHAR](150) NULL,
		[CodeOrFigureNum] [NVARCHAR](150) NULL,
		[NameAndSpecs] [NVARCHAR](150) NULL,
		[Materials] [NVARCHAR](150) NULL,
		[SuppliersID] [NVARCHAR](50) NULL,
		[SuppliersName] [NVARCHAR](150) NULL,
		[AmountOfUnit] [DECIMAL](18, 2) NULL,
		[Unit] [NVARCHAR](150) NULL,
		[Price] [DECIMAL](18, 2) NULL,
		[Amount] [DECIMAL](18, 2) NULL,
		[Borrowings] [NVARCHAR](200) NULL,
		[Remark] [NVARCHAR](300) NULL,
		[RelatedPicID] [NVARCHAR](50) NULL,
		[RelatedPicName] [NVARCHAR](150) NULL,
		[IsAnnex] [INT] NOT NULL,
		[IsDelete] [INT] NOT NULL,
		[CreationTime] [DATETIME2](7) NOT NULL,
		CONSTRAINT [PK_BOMDetails] 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]
		GO
	</sql>
</DB>