Check out example codes for "how create migration rails". It will help you in understanding the concepts better.

Code Example 1

def self.create_table
    sql = <<-SQL
      CREATE TABLE IF NOT EXISTS students (
        name TEXT,
        grade TEXT
      )
    SQL
    DB[:conn].execute(sql)
  end

Code Example 2

$ rails generate migration AddPartNumberToProducts

Code Example 3

rails g migration AddPartNumberToProducts

Learn ReactJs, React Native from akashmittal.com