在Rails中db:migrate之后postgreSQL文件在哪里?

时间:2023-01-18 00:12:21

When working with SQLite3, after I run bundle exec rake db:migrate, it updates the development.sqlite3 file in the db folder (itself in my app folder).

在使用SQLite3时,在运行bundle exec rake db:migrate之后,它会更新db文件夹(本身在我的app文件夹中)中的development.sqlite3文件。

I configured my Rails app to work with PostgreSQL, the databases and migrations work fine but I don't know where the associated files are created. Instead, I still see the same .sqlite3 files.

我将我的Rails应用程序配置为使用PostgreSQL,数据库和迁移工作正常,但我不知道创建关联文件的位置。相反,我仍然看到相同的.sqlite3文件。

Any idea where they are lodged, or maybe they're not even created? And why the .sqlite3 are still created if I run Rails with PostgreSQL?

知道他们在哪里提出,或者他们甚至没有创建?如果我用PostgreSQL运行Rails,为什么还会创建.sqlite3?

Thanks a lot.

非常感谢。

3 个解决方案

#1


4  

PostgreSQL does not have "a single" file with all the data, structure,... basically the whole database. This is the (dis-)advantage of SQLite: it has everything in a single file that makes development very easy.

PostgreSQL没有“单个”文件,包含所有数据,结构......基本上是整个数据库。这是SQLite的(dis-)优势:它将所有内容都放在一个文件中,使开发变得非常简单。

Depending on your platform, you have a postgresql folder somewhere where all data, table structures, indexes,... are stored. On Ubuntu, the location is per default

根据您的平台,您有一个postgresql文件夹,其中存储了所有数据,表结构,索引.......在Ubuntu上,该位置是默认的

/var/lib/postgresql/{pg_version}/main

#2


3  

PostgreSQL is a database server. Rails sends it commands, it executes them. Where it stores data files is configured in its configuration files. This is none of Rails' business.

PostgreSQL是一个数据库服务器。 Rails发送命令,执行它们。存储数据文件的位置在其配置文件中配置。这不是Rails的业务。

For example, for MySQL default data dir is /var/lib/mysql. For Postgres it must something similar. To know exact location consult your db server config files.

例如,对于MySQL,默认数据dir是/ var / lib / mysql。对于Postgres,它必须类似。要了解确切的位置,请参阅db server配置文件。

#3


0  

On Windows 8 I found the database in C:\Program Files\PostgreSQL\9.3\data\

在Windows 8上,我在C:\ Program Files \ PostgreSQL \ 9.3 \ data \中找到了数据库

#1


4  

PostgreSQL does not have "a single" file with all the data, structure,... basically the whole database. This is the (dis-)advantage of SQLite: it has everything in a single file that makes development very easy.

PostgreSQL没有“单个”文件,包含所有数据,结构......基本上是整个数据库。这是SQLite的(dis-)优势:它将所有内容都放在一个文件中,使开发变得非常简单。

Depending on your platform, you have a postgresql folder somewhere where all data, table structures, indexes,... are stored. On Ubuntu, the location is per default

根据您的平台,您有一个postgresql文件夹,其中存储了所有数据,表结构,索引.......在Ubuntu上,该位置是默认的

/var/lib/postgresql/{pg_version}/main

#2


3  

PostgreSQL is a database server. Rails sends it commands, it executes them. Where it stores data files is configured in its configuration files. This is none of Rails' business.

PostgreSQL是一个数据库服务器。 Rails发送命令,执行它们。存储数据文件的位置在其配置文件中配置。这不是Rails的业务。

For example, for MySQL default data dir is /var/lib/mysql. For Postgres it must something similar. To know exact location consult your db server config files.

例如,对于MySQL,默认数据dir是/ var / lib / mysql。对于Postgres,它必须类似。要了解确切的位置,请参阅db server配置文件。

#3


0  

On Windows 8 I found the database in C:\Program Files\PostgreSQL\9.3\data\

在Windows 8上,我在C:\ Program Files \ PostgreSQL \ 9.3 \ data \中找到了数据库