From be2a93525069de2dfa3c23b0c23e7a9f7ad4c03d Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 29 Dec 2024 15:14:43 +0100 Subject: First commit. --- db/migrate/20241226110255_create_tartiflettes.rb | 9 +++++++++ db/migrate/20241226113752_create_scores.rb | 11 +++++++++++ db/migrate/20241226113815_create_scoring_criteria.rb | 10 ++++++++++ db/migrate/20241227180909_create_users.rb | 11 +++++++++++ db/migrate/20241227180910_create_sessions.rb | 11 +++++++++++ db/migrate/20241227181134_add_admin_to_users.rb | 5 +++++ 6 files changed, 57 insertions(+) create mode 100644 db/migrate/20241226110255_create_tartiflettes.rb create mode 100644 db/migrate/20241226113752_create_scores.rb create mode 100644 db/migrate/20241226113815_create_scoring_criteria.rb create mode 100644 db/migrate/20241227180909_create_users.rb create mode 100644 db/migrate/20241227180910_create_sessions.rb create mode 100644 db/migrate/20241227181134_add_admin_to_users.rb (limited to 'db/migrate') diff --git a/db/migrate/20241226110255_create_tartiflettes.rb b/db/migrate/20241226110255_create_tartiflettes.rb new file mode 100644 index 0000000..17ee93f --- /dev/null +++ b/db/migrate/20241226110255_create_tartiflettes.rb @@ -0,0 +1,9 @@ +class CreateTartiflettes < ActiveRecord::Migration[8.0] + def change + create_table :tartiflettes do |t| + t.integer :scoring_id + + t.timestamps + end + end +end diff --git a/db/migrate/20241226113752_create_scores.rb b/db/migrate/20241226113752_create_scores.rb new file mode 100644 index 0000000..488baaa --- /dev/null +++ b/db/migrate/20241226113752_create_scores.rb @@ -0,0 +1,11 @@ +class CreateScores < ActiveRecord::Migration[8.0] + def change + create_table :scores do |t| + t.references :tartiflette, null: false, foreign_key: true + t.references :scoring_criterium, null: false, foreign_key: true + t.integer :value + + t.timestamps + end + end +end diff --git a/db/migrate/20241226113815_create_scoring_criteria.rb b/db/migrate/20241226113815_create_scoring_criteria.rb new file mode 100644 index 0000000..8370529 --- /dev/null +++ b/db/migrate/20241226113815_create_scoring_criteria.rb @@ -0,0 +1,10 @@ +class CreateScoringCriteria < ActiveRecord::Migration[8.0] + def change + create_table :scoring_criteria do |t| + t.string :name + t.string :category + + t.timestamps + end + end +end diff --git a/db/migrate/20241227180909_create_users.rb b/db/migrate/20241227180909_create_users.rb new file mode 100644 index 0000000..2075edf --- /dev/null +++ b/db/migrate/20241227180909_create_users.rb @@ -0,0 +1,11 @@ +class CreateUsers < ActiveRecord::Migration[8.0] + def change + create_table :users do |t| + t.string :email_address, null: false + t.string :password_digest, null: false + + t.timestamps + end + add_index :users, :email_address, unique: true + end +end diff --git a/db/migrate/20241227180910_create_sessions.rb b/db/migrate/20241227180910_create_sessions.rb new file mode 100644 index 0000000..8102f13 --- /dev/null +++ b/db/migrate/20241227180910_create_sessions.rb @@ -0,0 +1,11 @@ +class CreateSessions < ActiveRecord::Migration[8.0] + def change + create_table :sessions do |t| + t.references :user, null: false, foreign_key: true + t.string :ip_address + t.string :user_agent + + t.timestamps + end + end +end diff --git a/db/migrate/20241227181134_add_admin_to_users.rb b/db/migrate/20241227181134_add_admin_to_users.rb new file mode 100644 index 0000000..c1f08cf --- /dev/null +++ b/db/migrate/20241227181134_add_admin_to_users.rb @@ -0,0 +1,5 @@ +class AddAdminToUsers < ActiveRecord::Migration[8.0] + def change + add_column :users, :admin, :boolean, default: false + end +end -- cgit v1.2.3