--
-- Create Table SQL
--

USE [gmusic]
GO
CREATE TABLE [dbo].[ST_TOPIC_CHANGE](
    [CHANGE_SEQ] [int] IDENTITY(1,1) NOT NULL,
	[TOPIC_SEQ] [int] NOT NULL,
	[WRITER_SEQ] [int] NOT NULL,
	[CHANGE_GROUP_TYPE] [nvarchar](10) NULL,
	[CHANGE_CONTENT] [nvarchar](max) NULL,
	[CHANGE_STATUS] [nvarchar](10) NULL,
	[REVIEW_COMPLETE_DATE] [datetime] NULL,
	[CHANGE_COMPLETE_DATE] [datetime] NULL,
	[REG_USER_SEQ] [int] NOT NULL,
	[REG_DATE] [datetime] NOT NULL,
	[MOD_USER_SEQ] [int] NULL,
	[MOD_DATE] [datetime] NULL,
	CONSTRAINT [PK_ST_TOPIC_CHANGE] PRIMARY KEY CLUSTERED 
	(
		[CHANGE_SEQ] ASC
	)
) ON [PRIMARY]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'표제어 오류수정' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ST_TOPIC_CHANGE'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'오류수정순번' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ST_TOPIC_CHANGE', @level2type=N'COLUMN',@level2name=N'CHANGE_SEQ'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'표제어순번' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ST_TOPIC_CHANGE', @level2type=N'COLUMN',@level2name=N'TOPIC_SEQ'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'집필자순번' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ST_TOPIC_CHANGE', @level2type=N'COLUMN',@level2name=N'WRITER_SEQ'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'오류수정분류 (Code: CHANGE_GROUP_TYPE)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ST_TOPIC_CHANGE', @level2type=N'COLUMN',@level2name=N'CHANGE_GROUP_TYPE'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'오류수정내용' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ST_TOPIC_CHANGE', @level2type=N'COLUMN',@level2name=N'CHANGE_CONTENT'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'오류수정상태 (Code: CHANGE_STATUS)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ST_TOPIC_CHANGE', @level2type=N'COLUMN',@level2name=N'CHANGE_STATUS'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'검토완료일자' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ST_TOPIC_CHANGE', @level2type=N'COLUMN',@level2name=N'REVIEW_COMPLETE_DATE'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'수정완료일자' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ST_TOPIC_CHANGE', @level2type=N'COLUMN',@level2name=N'CHANGE_COMPLETE_DATE'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'등록사용자순번' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ST_TOPIC_CHANGE', @level2type=N'COLUMN',@level2name=N'REG_USER_SEQ'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'등록일자' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ST_TOPIC_CHANGE', @level2type=N'COLUMN',@level2name=N'REG_DATE'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'수정사용자순번' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ST_TOPIC_CHANGE', @level2type=N'COLUMN',@level2name=N'MOD_USER_SEQ'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'수정일자' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ST_TOPIC_CHANGE', @level2type=N'COLUMN',@level2name=N'MOD_DATE'
GO

--
-- Create Code GROUP & CODE DETAILS
--
INSERT INTO [dbo].[ST_CODE_MST]
           ([GRP_CODE]
           ,[GRP_CODE_NAME]
           ,[USE_FLAG]
           ,[DEL_FLAG]
           ,[REG_USER_SEQ]
           ,[REG_DATE])
     VALUES
           ('CHANGE_GROUP_TYPE'
           ,'오류수정분류'
           ,1
           ,0
           ,3
           ,getdate())
GO
INSERT INTO [dbo].[ST_CODE_MST]
           ([GRP_CODE]
           ,[GRP_CODE_NAME]
           ,[USE_FLAG]
           ,[DEL_FLAG]
           ,[REG_USER_SEQ]
           ,[REG_DATE])
     VALUES
           ('CHANGE_STATUS'
           ,'오류수정상태'
           ,1
           ,0
           ,3
           ,getdate())
GO

INSERT INTO [dbo].[ST_CODE_DTL]
           ([GRP_CODE]
           ,[CODE]
           ,[CODE_NAME]
           ,[ORDBY]
           ,[USE_FLAG]
           ,[DEL_FLAG]
           ,[REG_USER_SEQ]
           ,[REG_DATE])
     VALUES
           ('CHANGE_GROUP_TYPE'
           ,'CG01'
           ,'원고'
           ,1
           ,1
           ,0
           ,3
           ,getdate())
GO
INSERT INTO [dbo].[ST_CODE_DTL]
           ([GRP_CODE]
           ,[CODE]
           ,[CODE_NAME]
           ,[ORDBY]
           ,[USE_FLAG]
           ,[DEL_FLAG]
           ,[REG_USER_SEQ]
           ,[REG_DATE])
     VALUES
           ('CHANGE_GROUP_TYPE'
           ,'CG02'
           ,'복합매체'
           ,2
           ,1
           ,0
           ,3
           ,getdate())
GO
INSERT INTO [dbo].[ST_CODE_DTL]
           ([GRP_CODE]
           ,[CODE]
           ,[CODE_NAME]
           ,[ORDBY]
           ,[USE_FLAG]
           ,[DEL_FLAG]
           ,[REG_USER_SEQ]
           ,[REG_DATE])
     VALUES
           ('CHANGE_STATUS'
           ,'CS01'
           ,'검토중'
           ,1
           ,1
           ,0
           ,3
           ,getdate())
GO
INSERT INTO [dbo].[ST_CODE_DTL]
           ([GRP_CODE]
           ,[CODE]
           ,[CODE_NAME]
           ,[ORDBY]
           ,[USE_FLAG]
           ,[DEL_FLAG]
           ,[REG_USER_SEQ]
           ,[REG_DATE])
     VALUES
           ('CHANGE_STATUS'
           ,'CS02'
           ,'수정중'
           ,2
           ,1
           ,0
           ,3
           ,getdate())
GO
INSERT INTO [dbo].[ST_CODE_DTL]
           ([GRP_CODE]
           ,[CODE]
           ,[CODE_NAME]
           ,[ORDBY]
           ,[USE_FLAG]
           ,[DEL_FLAG]
           ,[REG_USER_SEQ]
           ,[REG_DATE])
     VALUES
           ('CHANGE_STATUS'
           ,'CS03'
           ,'수정완료'
           ,3
           ,1
           ,0
           ,3
           ,getdate())
GO

--
-- Create Menu and Menu Auth
--

INSERT INTO [dbo].[ST_MENU]
           ([MENU_CODE]
           ,[MENU_NAME]
           ,[PARENT_MENU_CODE]
           ,[MENU_LINK]
           ,[ORDBY]
           ,[USE_FLAG]
           ,[DEL_FLAG]
           ,[REG_USER_SEQ]
           ,[REG_DATE])
     VALUES
           ('M2010'
           ,'오류수정'
           ,'M20'
           ,'/topic/change'
           ,8
           ,1
           ,0
           ,3
           ,getDate())
GO

INSERT INTO [dbo].[ST_MENU_AUTH]
           ([AUTH]
           ,[MENU_CODE]
           ,[READ_AUTH_FLAG]
           ,[WRITE_AUTH_FLAG]
           ,[MOD_AUTH_FLAG]
           ,[DEL_AUTH_FLAG]
           ,[DEL_FLAG]
           ,[REG_USER_SEQ]
           ,[REG_DATE])
     VALUES
           ('AU00'
           ,'M2010'
           ,1
           ,0
           ,0
           ,0
           ,0
           ,3
           ,getDate())
GO

INSERT INTO [dbo].[ST_MENU_AUTH]
           ([AUTH]
           ,[MENU_CODE]
           ,[READ_AUTH_FLAG]
           ,[WRITE_AUTH_FLAG]
           ,[MOD_AUTH_FLAG]
           ,[DEL_AUTH_FLAG]
           ,[DEL_FLAG]
           ,[REG_USER_SEQ]
           ,[REG_DATE])
     VALUES
           ('AU01'
           ,'M2010'
           ,1
           ,0
           ,0
           ,0
           ,0
           ,3
           ,getDate())
GO

