-- =============================================
-- Application: Sample 61 - gsqlcmd Sync
-- Version 6.13, April 28, 2025
--
-- Copyright 2019-2025 Gartle LLC
--
-- License: MIT
-- =============================================

SET NOCOUNT ON;
GO

IF OBJECT_ID('[s61].[usp_commit_last_updates]', 'P') IS NOT NULL
DROP PROCEDURE [s61].[usp_commit_last_updates];
GO
IF OBJECT_ID('[s61].[usp_select_delete_rows]', 'P') IS NOT NULL
DROP PROCEDURE [s61].[usp_select_delete_rows];
GO
IF OBJECT_ID('[s61].[usp_select_upsert_rows]', 'P') IS NOT NULL
DROP PROCEDURE [s61].[usp_select_upsert_rows];
GO
IF OBJECT_ID('[s61].[usp_update_last_updates]', 'P') IS NOT NULL
DROP PROCEDURE [s61].[usp_update_last_updates];
GO

IF OBJECT_ID('[s61].[deleted_guids]', 'U') IS NOT NULL
DROP TABLE [s61].[deleted_guids];
GO
IF OBJECT_ID('[s61].[deleted_ints]', 'U') IS NOT NULL
DROP TABLE [s61].[deleted_ints];
GO
IF OBJECT_ID('[s61].[sync_last_updates]', 'U') IS NOT NULL
DROP TABLE [s61].[sync_last_updates];
GO
IF OBJECT_ID('[s61].[sync_timestamps]', 'U') IS NOT NULL
DROP TABLE [s61].[sync_timestamps];
GO
IF OBJECT_ID('[s61].[table11]', 'U') IS NOT NULL
DROP TABLE [s61].[table11];
GO
IF OBJECT_ID('[s61].[table12]', 'U') IS NOT NULL
DROP TABLE [s61].[table12];
GO
IF OBJECT_ID('[s61].[table13]', 'U') IS NOT NULL
DROP TABLE [s61].[table13];
GO
IF OBJECT_ID('[s61].[table14]', 'U') IS NOT NULL
DROP TABLE [s61].[table14];
GO
IF OBJECT_ID('[s61].[table21]', 'U') IS NOT NULL
DROP TABLE [s61].[table21];
GO
IF OBJECT_ID('[s61].[table22]', 'U') IS NOT NULL
DROP TABLE [s61].[table22];
GO
IF OBJECT_ID('[s61].[table31]', 'U') IS NOT NULL
DROP TABLE [s61].[table31];
GO
IF OBJECT_ID('[s61].[table32]', 'U') IS NOT NULL
DROP TABLE [s61].[table32];
GO
IF OBJECT_ID('[s61].[table41]', 'U') IS NOT NULL
DROP TABLE [s61].[table41];
GO
IF OBJECT_ID('[s61].[table42]', 'U') IS NOT NULL
DROP TABLE [s61].[table42];
GO
IF OBJECT_ID('[s61].[table51]', 'U') IS NOT NULL
DROP TABLE [s61].[table51];
GO
IF OBJECT_ID('[s61].[table52]', 'U') IS NOT NULL
DROP TABLE [s61].[table52];
GO
IF OBJECT_ID('[s61].[table71]', 'U') IS NOT NULL
DROP TABLE [s61].[table71];
GO
IF OBJECT_ID('[s61].[table72]', 'U') IS NOT NULL
DROP TABLE [s61].[table72];
GO

IF SCHEMA_ID('s61') IS NOT NULL
DROP SCHEMA [s61];
GO


IF DATABASE_PRINCIPAL_ID('sample61_user1') IS NOT NULL
DROP USER [sample61_user1];
GO
IF DATABASE_PRINCIPAL_ID('sample61_user2') IS NOT NULL
DROP USER [sample61_user2];
GO

print 'Application removed';
