1
0
Fork 0
forked from 2sys/phonograph
phonograph/mdengine/src/table_privileges.rs
2025-05-13 00:02:33 -07:00

27 lines
1.2 KiB
Rust

use diesel::{pg::Pg, prelude::*};
use crate::schema::table_privileges;
pub use crate::schema::table_privileges::{dsl, table};
#[derive(Clone, Debug, Queryable, Selectable)]
#[diesel(check_for_backend(Pg))]
#[diesel(table_name = table_privileges)]
pub struct TablePrivilege {
/// Name of the role that granted the privilege
pub grantor: String,
/// Name of the role that the privilege was granted to
pub grantee: String,
/// Name of the database that contains the table (always the current database)
pub table_catalog: String,
/// Name of the schema that contains the table
pub table_schema: String,
/// Name of the table
pub table_name: String,
/// Type of the privilege: SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, or TRIGGER
pub privilege_type: String,
/// YES if the privilege is grantable, NO if not
pub is_grantable: String,
/// In the SQL standard, WITH HIERARCHY OPTION is a separate (sub-)privilege allowing certain operations on table inheritance hierarchies. In PostgreSQL, this is included in the SELECT privilege, so this column shows YES if the privilege is SELECT, else NO.
pub with_hierarchy: String,
}