We used to rely on a Django fixtures to add a single record of initial
data to the afe_acl_groups table. We can simply move that data to the
schema, or, as done here, in a database version migration script.

This fixes issue #503.

Signed-off-by: Cleber Rosa <[email protected]>
---
 frontend/afe/fixtures/initial_data.json                         | 1 -
 frontend/migrations/070_add_acl_group_replace_django_fixture.py | 8 ++++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
 delete mode 100644 frontend/afe/fixtures/initial_data.json
 create mode 100644 
frontend/migrations/070_add_acl_group_replace_django_fixture.py

diff --git a/frontend/afe/fixtures/initial_data.json 
b/frontend/afe/fixtures/initial_data.json
deleted file mode 100644
index 3255791..0000000
--- a/frontend/afe/fixtures/initial_data.json
+++ /dev/null
@@ -1 +0,0 @@
-[{"pk": "1", "model": "afe.aclgroup", "fields": {"name": "Everyone", 
"description": ""}}]
diff --git a/frontend/migrations/070_add_acl_group_replace_django_fixture.py 
b/frontend/migrations/070_add_acl_group_replace_django_fixture.py
new file mode 100644
index 0000000..a1bae03
--- /dev/null
+++ b/frontend/migrations/070_add_acl_group_replace_django_fixture.py
@@ -0,0 +1,8 @@
+UP_SQL = """
+INSERT INTO afe_acl_groups (id, name) VALUES (1, 'Everyone') ON DUPLICATE KEY 
UPDATE name='Everyone';
+"""
+
+# Since this used to be a value INSERTED by Django fixtures, do not remove it
+# when downgrading versions
+DOWN_SQL = """
+"""
-- 
1.7.11.4

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to