summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20210520230216_create_titles.rb12
-rw-r--r--db/migrate/20210520230859_create_title_awards.rb10
2 files changed, 22 insertions, 0 deletions
diff --git a/db/migrate/20210520230216_create_titles.rb b/db/migrate/20210520230216_create_titles.rb
new file mode 100644
index 0000000..512773f
--- /dev/null
+++ b/db/migrate/20210520230216_create_titles.rb
@@ -0,0 +1,12 @@
+class CreateTitles < ActiveRecord::Migration[6.1]
+ def change
+ create_table :titles do |t|
+ t.string :gid
+ t.string :name
+
+ t.timestamps
+ end
+
+ add_reference :characters, :active_title, foreign_key: { to_table: :titles }
+ end
+end
diff --git a/db/migrate/20210520230859_create_title_awards.rb b/db/migrate/20210520230859_create_title_awards.rb
new file mode 100644
index 0000000..795cd5e
--- /dev/null
+++ b/db/migrate/20210520230859_create_title_awards.rb
@@ -0,0 +1,10 @@
+class CreateTitleAwards < ActiveRecord::Migration[6.1]
+ def change
+ create_table :title_awards do |t|
+ t.references :title, null: false, foreign_key: true
+ t.references :character, null: false, foreign_key: true
+
+ t.timestamps
+ end
+ end
+end