# frozen_string_literal: true class CreateCharacters < ActiveRecord::Migration[7.1] def change create_table :characters do |t| t.string :name, null: false t.belongs_to :table, null: true, foreign_key: true t.belongs_to :game_system, null: false, foreign_key: true t.belongs_to :user, null: false, foreign_key: true t.timestamps end add_check_constraint :characters, "length(name) <= 200", name: "chk_character_name_max_length" end end