Skip to content

Commit

Permalink
576: move ownership of the current user to azure_pg_admin
Browse files Browse the repository at this point in the history
  • Loading branch information
halprin committed Feb 8, 2024
1 parent 39e6585 commit b586922
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 60 deletions.
110 changes: 50 additions & 60 deletions etor/databaseMigrations/1.0.0.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
databaseChangeLog:
- changeSet:
id: 1
author: jeff.crichlake
author: jeff.crichlake
labels: create-type
context: metadata
comment: create status type
changes:
- sql:
sql: CREATE TYPE message_status AS ENUM ('PENDING', 'DELIVERED', 'FAILED')

- changeSet:
id: 2
author: jeff.crichlake
labels: azure
context: metadata
comment: transfer ownership of the message_status type in Azure environments
changes:
- sql:
sql: ALTER TYPE message_status OWNER TO azure_pg_admin
# - changeSet:
# id: 2
# author: jeff.crichlake
# labels: azure
# context: metadata
# comment: transfer ownership of the message_status type in Azure environments
# changes:
# - sql:
# sql: ALTER TYPE message_status OWNER TO azure_pg_admin

- changeSet:
id: 3
Expand All @@ -27,26 +27,26 @@ databaseChangeLog:
comment: create partner metadata table
changes:
- createTable:
tableName: metadata
tableName: metadata
columns:
- column:
name: received_message_id
type: varchar(40)
name: received_message_id
type: varchar(40)
constraints:
primaryKey: true
nullable: false
primaryKey: true
nullable: false
- column:
name: sent_message_id
type: varchar(40)
name: sent_message_id
type: varchar(40)
- column:
name: sender
type: varchar(30)
name: sender
type: varchar(30)
- column:
name: receiver
type: varchar(30)
name: receiver
type: varchar(30)
- column:
name: hash_of_order
type: varchar(1000)
name: hash_of_order
type: varchar(1000)
- column:
name: time_received
type: timestamptz
Expand All @@ -60,42 +60,32 @@ databaseChangeLog:
name: failure_reason
type: varchar(1000)

- changeSet:
id: 4
author: jeff.crichlake
labels: azure
context: metadata
comment: Allow Azure admin role to do anything to the metadata table
changes:
- sql:
sql: GRANT ALL ON metadata TO azure_pg_admin
# - changeSet:
# id: 4
# author: jeff.crichlake
# labels: azure
# context: metadata
# comment: Allow Azure admin role to do anything to the metadata table
# changes:
# - sql:
# sql: GRANT ALL ON metadata TO azure_pg_admin

- changeSet:
id: 5
author: jeff.crichlake
labels: azure
context: metadata
comment: Make Azure admin role the owner of the metadata table
changes:
- sql:
sql: ALTER TABLE metadata OWNER TO azure_pg_admin

- changeSet:
id: 6
author: jeff.crichlake
labels: azure
context: metadata
comment: Fix role issue
changes:
- sql:
sql: GRANT SELECT ON ALL TABLES IN SCHEMA public TO azure_pg_admin
# - changeSet:
# id: 5
# author: jeff.crichlake
# labels: azure
# context: metadata
# comment: Make Azure admin role the owner of the metadata table
# changes:
# - sql:
# sql: ALTER TABLE metadata OWNER TO azure_pg_admin

- changeSet:
id: 7
author: jeff.crichlake
labels: azure
context: metadata
comment: Fix role ownership
changes:
- sql:
sql: REASSIGN OWNED BY 'cdcti-github' TO 'azure_pg_admin'
# - changeSet:
# id: 6
# author: jeff.crichlake
# labels: azure
# context: metadata
# comment: Fix role issue
# changes:
# - sql:
# sql: GRANT SELECT ON ALL TABLES IN SCHEMA public TO azure_pg_admin
11 changes: 11 additions & 0 deletions etor/databaseMigrations/azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
databaseChangeLog:
- changeSet:
id: 1
author: halprin
labels: azure
context: azure
runAlways: true
comment: Fix ownership of anything created in every migration run
changes:
- sql:
sql: REASSIGN OWNED BY CURRENT_USER TO azure_pg_admin
3 changes: 3 additions & 0 deletions etor/databaseMigrations/root.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
databaseChangeLog:
- include:
file: etor/databaseMigrations/1.0.0.yml
- include:
file: etor/databaseMigrations/azure.yml
labels: azure

0 comments on commit b586922

Please sign in to comment.