Apply database hardening migrations

Approve and apply the latest set of database migrations for Phase 4: Application Boundary Hardening. These migrations include orphan image cleanup, slug validation triggers, monitoring and alerting infrastructure, and scheduled maintenance functions.
This commit is contained in:
gpt-engineer-app[bot]
2025-11-07 00:59:49 +00:00
parent eac9902bb0
commit 6bc5343256
2 changed files with 330 additions and 1 deletions

View File

@@ -1997,6 +1997,30 @@ export type Database = {
}
Relationships: []
}
orphaned_images: {
Row: {
cloudflare_id: string
created_at: string
id: string
image_url: string
marked_for_deletion_at: string | null
}
Insert: {
cloudflare_id: string
created_at?: string
id?: string
image_url: string
marked_for_deletion_at?: string | null
}
Update: {
cloudflare_id?: string
created_at?: string
id?: string
image_url?: string
marked_for_deletion_at?: string | null
}
Relationships: []
}
orphaned_images_log: {
Row: {
cleaned_up: boolean | null
@@ -5304,6 +5328,36 @@ export type Database = {
},
]
}
system_alerts: {
Row: {
alert_type: string
created_at: string
id: string
message: string
metadata: Json | null
resolved_at: string | null
severity: string
}
Insert: {
alert_type: string
created_at?: string
id?: string
message: string
metadata?: Json | null
resolved_at?: string | null
severity: string
}
Update: {
alert_type?: string
created_at?: string
id?: string
message?: string
metadata?: Json | null
resolved_at?: string | null
severity?: string
}
Relationships: []
}
test_data_registry: {
Row: {
created_at: string
@@ -5935,6 +5989,15 @@ export type Database = {
}
Relationships: []
}
system_health: {
Row: {
alerts_last_24h: number | null
checked_at: string | null
critical_alerts_count: number | null
orphaned_images_count: number | null
}
Relationships: []
}
}
Functions: {
anonymize_user_submissions: {
@@ -6041,6 +6104,15 @@ export type Database = {
}
Returns: string
}
create_system_alert: {
Args: {
p_alert_type: string
p_message: string
p_metadata?: Json
p_severity: string
}
Returns: string
}
delete_entity_from_submission: {
Args: {
p_deleted_by: string
@@ -6195,7 +6267,7 @@ export type Database = {
is_auth0_user: { Args: never; Returns: boolean }
is_moderator: { Args: { _user_id: string }; Returns: boolean }
is_superuser: { Args: { _user_id: string }; Returns: boolean }
is_user_banned: { Args: { _user_id: string }; Returns: boolean }
is_user_banned: { Args: { p_user_id: string }; Returns: boolean }
log_admin_action: {
Args: {
_action: string
@@ -6239,6 +6311,7 @@ export type Database = {
}
Returns: undefined
}
mark_orphaned_images: { Args: never; Returns: undefined }
migrate_ride_technical_data: { Args: never; Returns: undefined }
migrate_user_list_items: { Args: never; Returns: undefined }
process_approval_transaction: {
@@ -6276,6 +6349,14 @@ export type Database = {
}
Returns: string
}
run_system_maintenance: {
Args: never
Returns: {
details: Json
status: string
task: string
}[]
}
set_config_value: {
Args: {
is_local?: boolean