Coverage for crateweb/research/migrations/0007_sitewidequery.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-08-27 10:34 -0500

1""" 

2crate_anon/crateweb/research/migrations/0007_sitewidequery.py 

3 

4=============================================================================== 

5 

6 Copyright (C) 2015, University of Cambridge, Department of Psychiatry. 

7 Created by Rudolf Cardinal (rnc1001@cam.ac.uk). 

8 

9 This file is part of CRATE. 

10 

11 CRATE is free software: you can redistribute it and/or modify 

12 it under the terms of the GNU General Public License as published by 

13 the Free Software Foundation, either version 3 of the License, or 

14 (at your option) any later version. 

15 

16 CRATE is distributed in the hope that it will be useful, 

17 but WITHOUT ANY WARRANTY; without even the implied warranty of 

18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

19 GNU General Public License for more details. 

20 

21 You should have received a copy of the GNU General Public License 

22 along with CRATE. If not, see <https://www.gnu.org/licenses/>. 

23 

24=============================================================================== 

25 

26**Research app, migration 0007.** 

27 

28""" 

29 

30# Generated by Django 2.1.2 on 2018-10-22 08:01 

31 

32from cardinal_pythonlib.django.fields.jsonclassfield import JsonClassField 

33from django.db import migrations, models 

34 

35 

36class Migration(migrations.Migration): 

37 

38 dependencies = [ 

39 ("research", "0006_patientexplorer_pmq_hash"), 

40 ] 

41 

42 # noinspection PyPep8 

43 operations = [ 

44 migrations.CreateModel( 

45 name="SitewideQuery", 

46 fields=[ 

47 ("id", models.AutoField(primary_key=True, serialize=False)), 

48 ("sql", models.TextField(verbose_name="SQL query")), 

49 ( 

50 "sql_hash", 

51 models.BigIntegerField( 

52 verbose_name=( 

53 "64-bit non-cryptographic hash of SQL query" 

54 ) 

55 ), 

56 ), 

57 ( 

58 "args", 

59 JsonClassField( 

60 null=True, verbose_name="SQL arguments (as JSON)" 

61 ), 

62 ), 

63 ( 

64 "raw", 

65 models.BooleanField( 

66 default=False, 

67 verbose_name="SQL is raw, not parameter-substituted", 

68 ), 

69 ), 

70 ( 

71 "qmark", 

72 models.BooleanField( 

73 default=True, 

74 verbose_name=( 

75 "Parameter-substituted SQL uses ?, not %s, as" 

76 " placeholders" 

77 ), 

78 ), 

79 ), 

80 ("created", models.DateTimeField(auto_now_add=True)), 

81 ( 

82 "deleted", 

83 models.BooleanField( 

84 default=False, 

85 verbose_name=( 

86 "Deleted from the user's perspective. Audited" 

87 " queries are never properly deleted." 

88 ), 

89 ), 

90 ), 

91 ( 

92 "description", 

93 models.TextField( 

94 default="", verbose_name="query description" 

95 ), 

96 ), 

97 ], 

98 options={ 

99 "abstract": False, 

100 }, 

101 ), 

102 ]