-
Notifications
You must be signed in to change notification settings - Fork 2
/
salesTeardown.sql
35 lines (29 loc) · 1.43 KB
/
salesTeardown.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//=================================================================================
// drop top level objects
//=================================================================================
// Set context (this role inherits all owner roles in the sales heirarchy).
USE ROLE OKC_MEETUP_SALES_ADMIN;
// delete each top level object
DROP DATABASE IF EXISTS OKC_MEETUP_SALES_DB;
DROP WAREHOUSE IF EXISTS OKC_MEETUP_SALES_DEV_WH;
DROP WAREHOUSE IF EXISTS OKC_MEETUP_SALES_BI_WH;
DROP WAREHOUSE IF EXISTS OKC_MEETUP_SALES_DS_WH;
//=================================================================================
//=================================================================================
// delete security entities
//=================================================================================
USE ROLE SECURITYADMIN;
// delete business activity roles
DROP ROLE IF EXISTS OKC_MEETUP_SALES_ADMIN;
DROP ROLE IF EXISTS OKC_MEETUP_SALES_DATA_ENGINEER;
DROP ROLE IF EXISTS OKC_MEETUP_SALES_DATA_SCIENTIST;
DROP ROLE IF EXISTS OKC_MEETUP_SALES_BUS_ANALYST;
// delete object access roles
DROP ROLE IF EXISTS OKC_MEETUP_SALES_BI_READ;
DROP ROLE IF EXISTS OKC_MEETUP_SALES_BI_OWNER;
DROP ROLE IF EXISTS OKC_MEETUP_SALES_RAW_READ;
DROP ROLE IF EXISTS OKC_MEETUP_SALES_RAW_OWNER;
// delete users
DROP USER TONY_SOPRANO;
DROP USER OKC_MEETUP_SALES_ANALYTICS_SERVICE_ACCOUNT;
//=================================================================================