| 219 | |
| 220 | |
| 221 | class QueryLog(models.Model): |
| 222 | sql = models.TextField(blank=True) |
| 223 | query = models.ForeignKey( |
| 224 | Query, |
| 225 | null=True, |
| 226 | blank=True, |
| 227 | on_delete=models.SET_NULL |
| 228 | ) |
| 229 | run_by_user = models.ForeignKey( |
| 230 | settings.AUTH_USER_MODEL, |
| 231 | null=True, |
| 232 | blank=True, |
| 233 | on_delete=models.CASCADE |
| 234 | ) |
| 235 | run_at = models.DateTimeField(auto_now_add=True) |
| 236 | duration = models.FloatField(blank=True, null=True) # milliseconds |
| 237 | # NOTE this field is deprecated in favor of database_connection and no longer in use. |
| 238 | # It is present in the 6.0 release to preserve backwards compatibility in case there is need for a rollback. |
| 239 | # It will be removed in a future release (e.g. v6.1) |
| 240 | connection = models.CharField(blank=True, max_length=128, default="") |
| 241 | database_connection = models.ForeignKey(to=DatabaseConnection, on_delete=models.SET_NULL, null=True) |
| 242 | success = models.BooleanField(default=True) |
| 243 | error = models.TextField(blank=True, null=True) |
| 244 | |
| 245 | @property |
| 246 | def is_playground(self): |
| 247 | return self.query_id is None |
| 248 | |
| 249 | class Meta: |
| 250 | ordering = ["-run_at"] |
| 251 | |
| 252 | |
| 253 | class QueryFavorite(models.Model): |
no outgoing calls