add Axis, Category and Subject
This commit is contained in:
11
db/migrate/20220721123241_create_categories.rb
Normal file
11
db/migrate/20220721123241_create_categories.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class CreateCategories < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :categories do |t|
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index(:categories, :name, unique: true)
|
||||
end
|
||||
end
|
||||
11
db/migrate/20220721123254_create_axes.rb
Normal file
11
db/migrate/20220721123254_create_axes.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class CreateAxes < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :axes do |t|
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index(:axes, :name, unique: true)
|
||||
end
|
||||
end
|
||||
13
db/migrate/20220721123327_create_subjects.rb
Normal file
13
db/migrate/20220721123327_create_subjects.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class CreateSubjects < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :subjects do |t|
|
||||
t.string :name
|
||||
t.references :category, null: false, foreign_key: true
|
||||
t.references :axis, null: false, foreign_key: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index(:subjects, :name, unique: true)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user