"""
crate_anon/crateweb/research/migrations/0007_sitewidequery.py
===============================================================================
Copyright (C) 2015, University of Cambridge, Department of Psychiatry.
Created by Rudolf Cardinal (rnc1001@cam.ac.uk).
This file is part of CRATE.
CRATE is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CRATE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CRATE. If not, see <https://www.gnu.org/licenses/>.
===============================================================================
**Research app, migration 0007.**
"""
# Generated by Django 2.1.2 on 2018-10-22 08:01
from cardinal_pythonlib.django.fields.jsonclassfield import JsonClassField
from django.db import migrations, models
[docs]class Migration(migrations.Migration):
dependencies = [
("research", "0006_patientexplorer_pmq_hash"),
]
# noinspection PyPep8
operations = [
migrations.CreateModel(
name="SitewideQuery",
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
("sql", models.TextField(verbose_name="SQL query")),
(
"sql_hash",
models.BigIntegerField(
verbose_name=(
"64-bit non-cryptographic hash of SQL query"
)
),
), # nopep8
(
"args",
JsonClassField(
null=True, verbose_name="SQL arguments (as JSON)"
),
), # nopep8
(
"raw",
models.BooleanField(
default=False,
verbose_name="SQL is raw, not parameter-substituted",
),
), # nopep8
(
"qmark",
models.BooleanField(
default=True,
verbose_name=(
"Parameter-substituted SQL uses ?, not %s, as"
" placeholders"
),
),
), # nopep8
("created", models.DateTimeField(auto_now_add=True)),
(
"deleted",
models.BooleanField(
default=False,
verbose_name=(
"Deleted from the user's perspective. Audited"
" queries are never properly deleted."
),
),
), # nopep8
(
"description",
models.TextField(
default="", verbose_name="query description"
),
), # nopep8
],
options={
"abstract": False,
},
),
]