summaryrefslogtreecommitdiff
path: root/tko/migrations
diff options
context:
space:
mode:
authorshoward <showard@592f7852-d20e-0410-864c-8624ca9c26a4>2008-07-11 16:57:05 +0000
committershoward <showard@592f7852-d20e-0410-864c-8624ca9c26a4>2008-07-11 16:57:05 +0000
commit35c68576bbc65c9b1bfbf9bac412d7c5d7787c76 (patch)
tree3804bb1e50c6ddcfe9db49c3d5e0b51f9a9e93da /tko/migrations
parent30ff44d6037c481b9dd291f05a4e1a395b1d5348 (diff)
Migration file for test labels. Add a test_labels table and a test_labels_tests table that forms a many-to-many relationship between tests and test labels. The interface to manage these test labels is being developed as part of the new TKO interface.
git-svn-id: svn://test.kernel.org/autotest/trunk@1811 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'tko/migrations')
-rw-r--r--tko/migrations/009_add_test_labels.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tko/migrations/009_add_test_labels.py b/tko/migrations/009_add_test_labels.py
new file mode 100644
index 00000000..134c5764
--- /dev/null
+++ b/tko/migrations/009_add_test_labels.py
@@ -0,0 +1,27 @@
+CREATE_TABLES_SQL = """
+CREATE TABLE `test_labels` (
+ `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ `name` varchar(80) NOT NULL,
+ `description` longtext NOT NULL
+);
+
+CREATE TABLE `test_labels_tests` (
+ `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ `testlabel_id` integer NOT NULL REFERENCES `test_labels` (`id`),
+ `test_id` integer NOT NULL REFERENCES `tests` (`test_idx`),
+ UNIQUE (`testlabel_id`, `test_id`)
+);
+"""
+
+DROP_TABLES_SQL = """
+DROP TABLE IF EXISTS `test_labels`;
+DROP TABLE IF EXISTS `test_labels_tests`;
+"""
+
+
+def migrate_up(manager):
+ manager.execute_script(CREATE_TABLES_SQL)
+
+
+def migrate_down(manager):
+ manager.execute_script(DROP_TABLES_SQL)