Return True if the django_migrations table exists.
(self)
| 54 | return self.Migration.objects.using(self.connection.alias) |
| 55 | |
| 56 | def has_table(self): |
| 57 | """Return True if the django_migrations table exists.""" |
| 58 | # If the migrations table has already been confirmed to exist, don't |
| 59 | # recheck it's existence. |
| 60 | if self._has_table: |
| 61 | return True |
| 62 | # It hasn't been confirmed to exist, recheck. |
| 63 | with self.connection.cursor() as cursor: |
| 64 | tables = self.connection.introspection.table_names(cursor) |
| 65 | |
| 66 | self._has_table = self.Migration._meta.db_table in tables |
| 67 | return self._has_table |
| 68 | |
| 69 | def ensure_schema(self): |
| 70 | """Ensure the table exists and has the correct schema.""" |