Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7038241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:38:43+00:00 2026-05-28T01:38:43+00:00

Sometimes ago I created database and a table in MySQL with these statements :

  • 0

Sometimes ago I created database and a table in MySQL with these statements :

CREATE DATABASE amiref;
USE amiref;
CREATE TABLE refoo
(
  f1 VARCHAR(20) ,
  f2 VARCHAR(30) NOT NULL ,
  f3 INT ,
  PRIMARY KEY(f1)
);
CREATE TABLE IF NOT EXISTS users
(
  user_id1 VARCHAR(20) NOT NULL ,
  user_id2 VARCHAR(50) ,
  password VARCHAR(30) ,
  email VARCHAR(50) ,
  PRIMARY KEY(user_id1,user_id2)
);

know I want to create those database and tables in ruby on rail with model. how can I do it?
please help me.
thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:38:44+00:00Added an answer on May 28, 2026 at 1:38 am

    You do this using migrations. This is a real basic thing you should learn it from the scratch! You will find the documentation here:

    http://guides.rubyonrails.org/migrations.html

    THe migrations are included when you creat your models using the scaffolder => http://guides.rubyonrails.org/getting_started.html#getting-up-and-running-quickly-with-scaffolding

    //Also increase your acceppt rate!

    An example of a migration:

    Create a migration =>

    rails g migration testMigration
    

    Then youl find the migration in db/migrate. To create a table add:

    create_table :table_name do |f|
         f.integer :integer_column1
         f.string :string_column1, :string_column2
         f.boolean :boolean_column1
    end
    

    Then run the migration

    bundle exec rake db:migrate
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not long ago I started programming Python with Django. Sometimes I get strange errors
I often use print_r($value, true) to dump some variables in log statements, and sometimes
Sometimes my Oracle database on Windows gets hosed. How do I do a manual
Not too long ago I asked about setting up a DIV which scrolls with
I get this error randomly, sometimes it shows and sometimes not! The Error: Now
About a year ago, I picked up Scott Ambler's Refactoring Databases: Evolutionary Database Design
I am programming a game since 2 years ago. sometimes some memory errors (ie:
This line of XML I created sometime ago <char>48</char> is deserialised to '0'. The
A while ago I created a small cardgame web app for fun. The player
Sometime ago I was facing the problem the other way around: how to drag

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.