left4me/rails/db/migrate/20221127130223_create_keys.rb
mwiegand 34b1a009f2
wip
2022-11-27 19:23:31 +01:00

79 lines
1.9 KiB
Ruby

class CreateKeys < ActiveRecord::Migration[7.0]
def change
create_table :keys do |t|
t.string :title
t.string :short
t.string :ingame
t.string :keycap
t.timestamps
end
create_table :setups do |t|
t.string :name
t.timestamps
end
create_table :batches do |t|
t.timestamps
end
create_table :menus do |t|
t.string :name
t.references :setup, null: false, foreign_key: true
t.timestamps
end
create_table :menu_options do |t|
t.references :menu, null: false, foreign_key: true
t.references :batch, null: false, foreign_key: true
t.timestamps
end
create_table :wheels do |t|
t.string :name
t.references :setup, null: false, foreign_key: true
t.timestamps
end
create_table :wheel_options do |t|
t.references :wheel, null: false, foreign_key: true
t.references :batch, null: false, foreign_key: true
t.timestamps
end
create_table :key_binds do |t|
t.references :setup, null: false, foreign_key: true
t.references :key, null: false, foreign_key: true
t.references :batch, null: false, foreign_key: true
t.timestamps
end
create_table :datatypes do |t|
t.string :name
t.string :regex
t.integer :specifity
t.boolean :is_nestable, null: false
t.timestamps
end
create_table :commands do |t|
t.string :name
t.string :description
t.string :default
t.references :datatype, null: false, foreign_key: true
t.timestamps
end
create_table :executions do |t|
t.references :command, null: false, foreign_key: true
t.string :value
t.timestamps
end
create_table :actions do |t|
t.references :batch, null: false, foreign_key: true
t.references :actionable, polymorphic: true, null: false
t.timestamps
end
end
end