USE [stockholm_db]
GO
/****** Object:  ForeignKey [FK_Badges_Roles]    Script Date: 11/01/2009 23:30:04 ******/
ALTER TABLE [dbo].[Badges] DROP CONSTRAINT [FK_Badges_Roles]
GO
/****** Object:  ForeignKey [FK_RoleAccess_Roles]    Script Date: 11/01/2009 23:30:04 ******/
ALTER TABLE [dbo].[RoleAccess] DROP CONSTRAINT [FK_RoleAccess_Roles]
GO

ALTER TABLE [dbo].[Badges] DROP CONSTRAINT [FK_Badges_Roles]
GO
DROP TABLE [dbo].[Badges]
GO
/****** Object:  Table [dbo].[RoleAccess]    Script Date: 11/01/2009 23:30:04 ******/
ALTER TABLE [dbo].[RoleAccess] DROP CONSTRAINT [FK_RoleAccess_Roles]
GO
DROP TABLE [dbo].[RoleAccess]
GO

DROP TABLE [dbo].[Roles]
GO
/****** Object:  Table [dbo].[Settings]    Script Date: 11/01/2009 23:30:04 ******/
DROP TABLE [dbo].[Settings]
GO
/****** Object:  Table [dbo].[Settings]    Script Date: 11/01/2009 23:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Settings](
	[SettingsVersion] [int] IDENTITY(1,1) NOT NULL,
	[DatabaseVersion] [int] NOT NULL,
 CONSTRAINT [PK_Settings] PRIMARY KEY CLUSTERED 
(
	[SettingsVersion] 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
SET IDENTITY_INSERT [dbo].[Settings] ON
INSERT [dbo].[Settings] ([SettingsVersion], [DatabaseVersion]) VALUES (1, 1)
SET IDENTITY_INSERT [dbo].[Settings] OFF
/****** Object:  Table [dbo].[Roles]    Script Date: 11/01/2009 23:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Roles](
	[RoleID] [int] IDENTITY(1,1) NOT NULL,
	[RoleName] [varchar](50) NOT NULL,
	[InheritedRole] [int] NULL,
 CONSTRAINT [PK_Roles] PRIMARY KEY CLUSTERED 
(
	[RoleID] 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
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[Roles] ON
INSERT [dbo].[Roles] ([RoleID], [RoleName], [InheritedRole]) VALUES (1, N'User', NULL)
INSERT [dbo].[Roles] ([RoleID], [RoleName], [InheritedRole]) VALUES (2, N'VIP', 1)
INSERT [dbo].[Roles] ([RoleID], [RoleName], [InheritedRole]) VALUES (3, N'Trainee Hobba', 2)
INSERT [dbo].[Roles] ([RoleID], [RoleName], [InheritedRole]) VALUES (4, N'Hobba', 3)
INSERT [dbo].[Roles] ([RoleID], [RoleName], [InheritedRole]) VALUES (5, N'Supervisor Hobba', 4)
INSERT [dbo].[Roles] ([RoleID], [RoleName], [InheritedRole]) VALUES (6, N'Moderator', 5)
INSERT [dbo].[Roles] ([RoleID], [RoleName], [InheritedRole]) VALUES (7, N'Admin', 6)
SET IDENTITY_INSERT [dbo].[Roles] OFF
/****** Object:  Table [dbo].[Users]    Script Date: 11/01/2009 23:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
SET ANSI_PADDING OFF
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[RoleAccess](
	[RoleAccessID] [int] IDENTITY(1,1) NOT NULL,
	[RoleID] [int] NOT NULL,
	[AccessName] [varchar](50) NOT NULL,
 CONSTRAINT [PK_RoleAccess] PRIMARY KEY CLUSTERED 
(
	[RoleAccessID] 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
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[RoleAccess] ON
INSERT [dbo].[RoleAccess] ([RoleAccessID], [RoleID], [AccessName]) VALUES (1, 1, N'fuse_login')
SET IDENTITY_INSERT [dbo].[RoleAccess] OFF
/****** Object:  Table [dbo].[Badges]    Script Date: 11/01/2009 23:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Badges](
	[BadgeID] [int] IDENTITY(1,1) NOT NULL,
	[BadgeName] [varchar](10) NOT NULL,
	[RoleID] [int] NOT NULL,
 CONSTRAINT [PK_Badges] PRIMARY KEY CLUSTERED 
(
	[BadgeID] 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
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[Badges] ON
INSERT [dbo].[Badges] ([BadgeID], [BadgeName], [RoleID]) VALUES (1, N'ADM', 7)
SET IDENTITY_INSERT [dbo].[Badges] OFF
/****** Object:  ForeignKey [FK_Badges_Roles]    Script Date: 11/01/2009 23:30:04 ******/
ALTER TABLE [dbo].[Badges]  WITH CHECK ADD  CONSTRAINT [FK_Badges_Roles] FOREIGN KEY([RoleID])
REFERENCES [dbo].[Roles] ([RoleID])
GO
ALTER TABLE [dbo].[Badges] CHECK CONSTRAINT [FK_Badges_Roles]
GO
/****** Object:  ForeignKey [FK_RoleAccess_Roles]    Script Date: 11/01/2009 23:30:04 ******/
ALTER TABLE [dbo].[RoleAccess]  WITH CHECK ADD  CONSTRAINT [FK_RoleAccess_Roles] FOREIGN KEY([RoleID])
REFERENCES [dbo].[Roles] ([RoleID])
GO
ALTER TABLE [dbo].[RoleAccess] CHECK CONSTRAINT [FK_RoleAccess_Roles]
GO
