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
commit270d2a3735ec65b58bdb23678aaede1b0ff90b7d (patch)
treee6da7c67ae8c7a624cbb49399ae9f8b45be8ea30 /archaeological_context_records/models.py
parent4158b9a7119cd4ba4ddbfc2c92752d94c423a65b (diff)
downloadIshtar-270d2a3735ec65b58bdb23678aaede1b0ff90b7d.tar.bz2
Ishtar-270d2a3735ec65b58bdb23678aaede1b0ff90b7d.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",