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 8776139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:58:47+00:00 2026-06-13T18:58:47+00:00

Currently I interact with specific table in database through ActiveRecord . I’ll know the

  • 0

Currently I interact with specific table in database through ActiveRecord. I’ll know the table name in advance and I’ll create table by rails generate model modelname column1:string ....

But now, I get this requirement that the table name is unknown as well as how many tables there will be.

For example : In directory Projects, there’re many sub directories such as : Projects_A, Project_B, Project_C … I need to create separate tables for each of these projects. But you don’t know how many project there’ll be. And I need to dynamically create these tables in my code. How to achieve that in my code? Do I use ActiveRecord to achieve that or any other methods?

Codes like:

list = maintain_a_dir_list()

Dir.entries( dir ).each { |e|
  if e is not in list
    create_a_table_after_e_name
  end
}

Here I will explain why I want to create such tables :

The directory name and its sub folder name I mentioned above is unreal. So let’s told this story all over again.

I am a load tester. I do load test for one of our company’s projects. Let’s say the project’s name is Project_A. Project_A has many versions, like 1.0, 2.0 and so on. So in every release I’ll do many rounds of load test to ensure the product’s quality.

So the relationship between project, verson and loadtest report is simple : project contains many versions. And each version contains many loadtest reports which executed in different days.

The information in loadtest report is as following :

transaction name | min time | average response time | max time

transaction_01 | 1.0s | 2.0s | 3.0s

transaction_02 | 0.5s | 1.5s | 4.0s

…

To store the reports information in database, I create a table named transactions_table. The table is like this :

report_name | transaction_name | min | average | max

20121001_100users_4hours | transaction_01 | 1.0 | 2.0 | 3.0

20121001_100users_4hours | transaction_02 | 1.0 | 2.0 | 3.0

…

20121002_100users_2hours | transaction_01 | 1.5 | 2.1 | 2.5

20121002_100users_2hours | transaction_02 | 1.1 | 2.1 | 2.7

…

…

Then I want to get the version information involved. So I create another table named reports_table. The table is like this :

version | report_name

project_a_1.0 | 20121001_100users_4hours

project_a_1.0 | 20121002_100users_2hours

…

project_a_2.0 | 20121101_50users_1hours

project_a_2.0 | 20121102_50users_2hours

…

…

And ofcourse there’s more than one project in my company. There’ll be Project_B, Project_C and D… So again comes the version table consist of the Project name and its versions.

It’s the first time I design the relationship of DB tables. So I don’t know whether the way i organize table is right.

Firstly, I simply think I can put all the transaction data–no matter which project or version it belongs–in transactions_table. Then I realize the report name from different projects or versions may be the same. Then it cannot seperate transactions_table using select * from transactions_table where report_name = "xxxx". And the transactions_table‘s size will increase more rapidly than the other two tables.

So that’s why I am considering to store the reports in different projects to different table.

  • 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-06-13T18:58:48+00:00Added an answer on June 13, 2026 at 6:58 pm

    May better to use folder_name field in projects table?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently writing some MATLAB code to interact with my company's internal reports database.
I am using PHP's PDO to interact with a MySQL database. I am currently
I'm currently doing a project where I have to interact with a circuit I
I'm using soci for making my app interact with databases and currently I use
Currently I have this code: <?php echo '<meta name=robots content=noindex>'; $arr = json_decode(file_get_contents(http://media1.clubpenguin.com/play/en/web_service/game_configs/ paper_items.json),true);
I am currently involved in the development of a large rails application that interfaces
I am currently starting a project that will interact with Twitter via it's OpenAuth
I have several web services that logged-in user interact with. Currently they're running on
in an application I'm working on, I need to interact with iPhone's AddressBook. Currently,
I'm currently in the process of programming a server which can let clients interact

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.