1

I have created a new rails project and I have added a migration to create a table called blogs. When I ran rake db:migrate it created this table along with other tables I have set in different projects. Under db/migrate I have only 1 file with the migration I added, there's no reference in the project of the other tables, for some reason it is pulling the migrations from other projects and adding it to my DB project

Rails version: 5.1.4 Ruby version: 2.4.1

Chetan Datta
  • 447
  • 9
  • 19

3 Answers3

3

Probably you're using the same database. You need to specify different database in the config\database.yml file for each project. You can have same username, same password, etc. but At least the database: (database name) have to be different if you don't want all your tables in one database

olucube.com
  • 330
  • 2
  • 11
0

You need to configure your database.yml for each project.

And create 3 databases for development, test and production.

And specify all the information needed to access your database.

Eg:

development:
  adapter: postgresql
  username: postgres
  password: blogs_postgres
  database: blogs_development
  encoding: utf8
  host: localhost
  pool: 5
  timeout: 5000

Refer Here for more info.

Chetan Datta
  • 447
  • 9
  • 19
0

I just solved my issue, seems like Spring was mixing things up in my environment. Reference: https://github.com/rails/rails/issues/31529#issuecomment-353269787