summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20250101125043_add_session_id_to_scores.rb6
-rw-r--r--db/migrate/20250101141642_add_unique_index_to_scores.rb8
-rw-r--r--db/migrate/20250101160120_add_not_null_constraint_to_session_id_in_scores.rb5
3 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20250101125043_add_session_id_to_scores.rb b/db/migrate/20250101125043_add_session_id_to_scores.rb
new file mode 100644
index 0000000..574fa7f
--- /dev/null
+++ b/db/migrate/20250101125043_add_session_id_to_scores.rb
@@ -0,0 +1,6 @@
+class AddSessionIdToScores < ActiveRecord::Migration[8.0]
+ def change
+ add_column :scores, :session_id, :string
+ add_index :scores, :session_id
+ end
+end
diff --git a/db/migrate/20250101141642_add_unique_index_to_scores.rb b/db/migrate/20250101141642_add_unique_index_to_scores.rb
new file mode 100644
index 0000000..8efde1f
--- /dev/null
+++ b/db/migrate/20250101141642_add_unique_index_to_scores.rb
@@ -0,0 +1,8 @@
+class AddUniqueIndexToScores < ActiveRecord::Migration[8.0]
+ def change
+ add_index :scores,
+ [:tartiflette_id, :scoring_criterium_id, :session_id],
+ unique: true,
+ name: "index_scores_on_tartiflette_criterium_session"
+ end
+end
diff --git a/db/migrate/20250101160120_add_not_null_constraint_to_session_id_in_scores.rb b/db/migrate/20250101160120_add_not_null_constraint_to_session_id_in_scores.rb
new file mode 100644
index 0000000..71e174e
--- /dev/null
+++ b/db/migrate/20250101160120_add_not_null_constraint_to_session_id_in_scores.rb
@@ -0,0 +1,5 @@
+class AddNotNullConstraintToSessionIdInScores < ActiveRecord::Migration[8.0]
+ def change
+ change_column_null :scores, :session_id, false
+ end
+end
Copyright 2019--2025 Marius PETER