{
	"Name": "GNSS for Tachoplus Addon for SQLSERVER 2008",
	"Version": 1,
	"RestoreDatabase": {
		"MinSqlServerMajorVersion": 10,
		"DatabaseName": "db_tplus_maps",
		"FileName": "db_tplus_maps_2008.bak",
		"DropIfDatabaseExists": true		
	},
	"RunSqlStatements": [{
			"MinSqlServerMajorVersion": 10,
			"DestinationDatabaseName": "db_tplus_maps",
			"Sql": 
			[
			"
			IF (EXISTS (SELECT name
			FROM master.dbo.sysdatabases
			WHERE ('[' + name + ']' = '{DatabaseName}'  OR name = '{DatabaseName}'))) begin

			use db_tplus_maps;
			IF USER_ID('{TachoPlusUser}') IS NULL
			exec sp_adduser '{TachoPlusUser}'

			EXEC sp_addrolemember 'db_datareader', '{TachoPlusUser}'
			GRANT EXECUTE ON SCHEMA::dbo TO {TachoPlusUser};

			EXEC sp_change_users_login 'Auto_Fix', '{TachoPlusUser}'
			end

			"]
		}
	]
}
