summaryrefslogtreecommitdiff
path: root/archaeological_context_records/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-04-18 22:59:43 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-04-18 22:59:43 +0200
commite886e8a1a79880bed9cd0ec480a0658ae93ad400 (patch)
treee6da7c67ae8c7a624cbb49399ae9f8b45be8ea30 /archaeological_context_records/models.py
parentc5571208a3d7a50d24226132d6ff77f8edd03921 (diff)
downloadIshtar-e886e8a1a79880bed9cd0ec480a0658ae93ad400.tar.bz2
Ishtar-e886e8a1a79880bed9cd0ec480a0658ae93ad400.zip
New migrations: add views
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r--archaeological_context_records/models.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index 3fdc04f21..0a5ab7cbc 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -545,7 +545,7 @@ post_delete.connect(post_delete_record_relation, sender=RecordRelations)
class RecordRelationView(models.Model):
- """
+ CREATE_SQL = """
CREATE VIEW record_relations AS
SELECT DISTINCT right_record_id as id,
right_record_id,
@@ -557,6 +557,9 @@ class RecordRelationView(models.Model):
CREATE RULE record_relations_del AS ON DELETE TO record_relations
DO INSTEAD DELETE FROM record_relations where id=NULL;
"""
+ DELETE_SQL = """
+ DROP VIEW record_relations;
+ """
TABLE_COLS = [
"relation_type",
"right_record__label", "right_record__unit", "right_record__parcel",