IF SCHEMA_ID('dev') IS NULL BEGIN
  EXEC sp_executesql N'CREATE SCHEMA dev' 
END
GO

IF SCHEMA_ID('auditlog') IS NULL BEGIN
  EXEC sp_executesql N'CREATE SCHEMA auditlog' 
END
GO

IF NOT EXISTS (SELECT 1 FROM sys.database_principals WHERE [name] = 'kreta_tech_user') BEGIN
  CREATE USER kreta_tech_user WITHOUT LOGIN
  EXEC sp_addrolemember N'db_owner', N'kreta_tech_user'; 
END

