(&self, _table: T, _column: C)
| 105 | } |
| 106 | |
| 107 | pub async fn has_column<T, C>(&self, _table: T, _column: C) -> Result<bool, DbErr> |
| 108 | where |
| 109 | T: AsRef<str>, |
| 110 | C: AsRef<str>, |
| 111 | { |
| 112 | let _stmt: SelectStatement = match self.conn.get_database_backend() { |
| 113 | #[cfg(feature = "sqlx-mysql")] |
| 114 | DbBackend::MySql => sea_schema::mysql::MySql.has_column(_table, _column), |
| 115 | #[cfg(feature = "sqlx-postgres")] |
| 116 | DbBackend::Postgres => sea_schema::postgres::Postgres.has_column(_table, _column), |
| 117 | #[cfg(feature = "sqlx-sqlite")] |
| 118 | DbBackend::Sqlite => sea_schema::sqlite::Sqlite.has_column(_table, _column), |
| 119 | #[allow(unreachable_patterns)] |
| 120 | other => panic!("{other:?} feature is off"), |
| 121 | }; |
| 122 | |
| 123 | #[allow(unreachable_code)] |
| 124 | let builder = self.conn.get_database_backend(); |
| 125 | let res = self |
| 126 | .conn |
| 127 | .query_one(builder.build(&_stmt)) |
| 128 | .await? |
| 129 | .ok_or_else(|| DbErr::Custom("Failed to check column exists".to_owned()))?; |
| 130 | |
| 131 | res.try_get("", "has_column") |
| 132 | } |
| 133 | |
| 134 | pub async fn has_index<T, I>(&self, _table: T, _index: I) -> Result<bool, DbErr> |
| 135 | where |
nothing calls this directly
no test coverage detected