|
1 | 1 | -- Script: pesterdb.sql |
2 | 2 | -- Description: This script can be used to configure a new SQL Server 2014 instance for PowerUpSQL Pester tests. |
3 | 3 |
|
| 4 | +------------------------------------------------------------ |
| 5 | +-- Create Logins, Database Users, and Grant Assembly Privs |
| 6 | +------------------------------------------------------------ |
| 7 | + |
| 8 | +-- Create db_ddladmin login |
| 9 | +If not Exists (select loginname from master.dbo.syslogins where name = 'test_login_ddladmin') |
| 10 | +CREATE LOGIN [test_login_ddladmin] WITH PASSWORD = 'test_login_ddladmin', CHECK_POLICY = OFF; |
| 11 | + |
| 12 | +-- Create db_ddladmin database user |
| 13 | +If not Exists (SELECT name FROM sys.database_principals where name = 'test_login_ddladmin') |
| 14 | +CREATE USER [test_login_ddladmin] FROM LOGIN [test_login_ddladmin]; |
| 15 | +GO |
| 16 | + |
| 17 | +-- Add test_login_ddladmin to db_ddladmin role |
| 18 | +EXEC sp_addrolemember [db_ddladmin], [test_login_ddladmin]; |
| 19 | +GO |
| 20 | + |
| 21 | +-- Create login with the CREATE ASSEMBLY database privilege |
| 22 | +If not Exists (select loginname from master.dbo.syslogins where name = 'test_login_createassembly') |
| 23 | +CREATE LOGIN [test_login_createassembly] WITH PASSWORD = 'test_login_createassembly', CHECK_POLICY = OFF; |
| 24 | + |
| 25 | +-- Create test_login_createassembly database user |
| 26 | +If not Exists (SELECT name FROM sys.database_principals where name = 'test_login_createassembly') |
| 27 | +CREATE USER [test_login_createassembly] FROM LOGIN [test_login_createassembly]; |
| 28 | +GO |
| 29 | + |
| 30 | +-- Add privilege |
| 31 | +GRANT CREATE ASSEMBLY to [test_login_createassembly]; |
| 32 | +GO |
| 33 | + |
| 34 | +-- Create login with the ALTER ANY ASSEMBLY database privilege |
| 35 | +If not Exists (select loginname from master.dbo.syslogins where name = 'test_login_alterassembly') |
| 36 | +CREATE LOGIN [test_login_alterassembly] WITH PASSWORD = 'test_login_alterassembly', CHECK_POLICY = OFF; |
| 37 | + |
| 38 | +-- Create test_login_alterassembly database user |
| 39 | +If not Exists (SELECT name FROM sys.database_principals where name = 'test_login_alterassembly') |
| 40 | +CREATE USER [test_login_alterassembly] FROM LOGIN [test_login_alterassembly]; |
| 41 | +GO |
| 42 | + |
| 43 | +-- Add privilege |
| 44 | +GRANT ALTER ANY ASSEMBLY to [test_login_alterassembly]; |
| 45 | +GO |
4 | 46 | ------------------------------------------------------------ |
5 | 47 | -- Create Test SQL Logins |
6 | 48 | ------------------------------------------------------------ |
|
0 commit comments