Skip to content

Commit

Permalink
Adding 'nextauth' user as sysadmin.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr D authored and iaincollins committed Aug 31, 2020
1 parent 8f0501b commit 351b804
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions test/docker/mssql/setup.sql
@@ -1,15 +1,29 @@
USE master;
if not exists (select name from sys.syslogins where name = 'nextauth')
USE master;
/* did you tear down the container ? */
if not exists (select name
from sys.syslogins
where name = 'nextauth')
CREATE LOGIN nextauth
WITH PASSWORD = 'password',
CHECK_POLICY = OFF;
GO
if not exists (select name from sys.databases where name = 'nextauth' )
/* did you tear down the container ? */
if not exists (select name
from sys.databases
where name = 'nextauth' )
CREATE database nextauth
GO
USE nextauth;
if not exists(select [name] from sys.sysusers where name= 'nextauth')
CREATE USER nextauth FOR LOGIN nextauth
/* did you tear down the container ? */
if not exists(select [name]
from sys.sysusers
where name= 'nextauth')
CREATE USER nextauth
WITH DEFAULT_SCHEMA =[dbo];
GO
EXEC sp_addrolemember 'db_owner', 'nextauth'
/*
* Adding user as sysadmin,
* So you can easily drop/create/re-create/alter the database
* You will need to login to 'master' to do that
*/
exec sp_addsrvrolemember @loginame = N'nextauth', @rolename = N'sysadmin'

1 comment on commit 351b804

@vercel
Copy link

@vercel vercel bot commented on 351b804 Aug 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.