Return the column definition for a field. The field must already have had set_attributes_from_name() called.
(self, model, field, include_default=False)
| 380 | yield self._comment_sql(field.db_comment) |
| 381 | |
| 382 | def column_sql(self, model, field, include_default=False): |
| 383 | """ |
| 384 | Return the column definition for a field. The field must already have |
| 385 | had set_attributes_from_name() called. |
| 386 | """ |
| 387 | # Get the column's type and use that as the basis of the SQL. |
| 388 | field_db_params = field.db_parameters(connection=self.connection) |
| 389 | column_db_type = field_db_params["type"] |
| 390 | # Check for fields that aren't actually columns (e.g. M2M). |
| 391 | if column_db_type is None: |
| 392 | return None, None |
| 393 | params = [] |
| 394 | return ( |
| 395 | " ".join( |
| 396 | # This appends to the params being returned. |
| 397 | self._iter_column_sql( |
| 398 | column_db_type, |
| 399 | params, |
| 400 | model, |
| 401 | field, |
| 402 | field_db_params, |
| 403 | include_default, |
| 404 | ) |
| 405 | ), |
| 406 | params, |
| 407 | ) |
| 408 | |
| 409 | def skip_default(self, field): |
| 410 | """ |
no test coverage detected