

Sample config/database.yml from Rails. Postgres, MySQL, and SQLite
source link: https://gist.github.com/jwo/4512764
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Sample config/database.yml from Rails. Postgres, MySQL, and SQLite · GitHub
Instantly share code, notes, and snippets.
I'm not convinced about the sqlite-database.yml
config/database.sqlite3.yml
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
Pserg commented on Nov 8, 2017
Why you using unicode instead of utf8 in postgres.database.yml?
@Pserg it doesn't matter, unicode is just a standard
This is a huge help. thanks!
Hi,
Is it possible to use the same Postgres database name for development and production? E.g.
sample_postgres in the two environments?
if yes: How to ensure the same data content when running in production?
Author
jwo commented on Sep 20, 2019
Is it possible to use the same Postgres database name for development and production? E.g.
@dangerrg Yes, nothing will prevent that
if yes: How to ensure the same data content when running in production?
I don't know what you mean
I am using Rails 5.2 and mysql2 gem. Even though i am using actual host name in my database.yml for production config, when i run the command RAILS_ENV=production rake db:migrate it is taking host name as local ip address of my machine and shows below error.
rake aborted!
ActiveRecord::StatementInvalid: Mysql2::Error: CREATE command denied to
user 'username'@'lamu02rr8r9fvh7.xxx.com' for table
'schema_migrations': CREATE TABLE `schema_migrations` (`version`
varchar(255) NOT NULL PRIMARY KEY)
/Users/egoutham/.rvm/gems/ruby-2.5.3/gems/mysql2
0.4.10/lib/mysql2/client.rb:120:in `_query'
/Users/egoutham/.rvm/gems/ruby-2.5.3/gems/mysql2-
0.4.10/lib/mysql2/client.rb:120:in `block in query'
/Users/egoutham/.rvm/gems/ruby-2.5.3/gems/mysql2-
0.4.10/lib/mysql2/client.rb:119:in `handle_interrupt'
/Users/egoutham/.rvm/gems/ruby-2.5.3/gems/mysql2-
0.4.10/lib/mysql2/client.rb:119:in `query'
And when i run the below command it shows different error.
RAILS_ENV=production rake db:create
rake aborted!
ActiveRecord::StatementInvalid: Mysql2::Error: Access denied for user
'username'@'%' to database 'dashboard': CREATE DATABASE `dashboard`
DEFAULT CHARACTER SET `utf8mb4`
/Users/egoutham/.rvm/gems/ruby-2.5.3/gems/mysql2-
0.4.10/lib/mysql2/client.rb:120:in `_query'
/Users/egoutham/.rvm/gems/ruby-2.5.3/gems/mysql2-
0.4.10/lib/mysql2/client.rb:120:in `block in query'
/Users/egoutham/.rvm/gems/ruby-2.5.3/gems/mysql2-
0.4.10/lib/mysql2/client.rb:119:in `handle_interrupt'
/Users/egoutham/.rvm/gems/ruby-2.5.3/gems/mysql2-
0.4.10/lib/mysql2/client.rb:119:in `query'
Recommend
-
11
MySQL 与 Postgres 和 SQLite 的对比和优缺点发布于 2020年08月31日 | 上次编辑:2020年09月01日 本文比较和对比了三个最广泛使用的开源 RDBMS:SQLite、MySQL 和 PostgreSQL。具体地说,我们会探讨每个 RDBMS 使用...
-
4
Rails 7 adds support for setting the schema dump filepath in the database config Mar 9, 2022 , by Swaathi Kakarla 1 minute...
-
9
// Tutorial //SQLite vs MySQL vs PostgreSQL: A Comparison Of Relational Database Management Systems
-
6
Postlite Postlite is a network proxy to allow access to remote SQLite databases over the Postgres wire protocol. This allows GUI tools to be used on remote SQLite databases which can make administration easier. The proxy work...
-
8
Ship It! – Episode #59 Postgres vs SQLite with Litestream featuring Ben Johnson from litestream.io
-
1
sample postgres query (from simple to advance) · GitHub Instantly share code, notes, and snippets. ...
-
5
A while back, I wrote the article Tuning MySQL my.cnf? Avoid this common pitfall!
-
8
SQLite is usually very forgiving of unexpected or unusual inputs. However, when moving from SQLite to another database, this can cause problems. Rails 7.0 adds a :strict option to the default database.yml file to cir...
-
6
@junglesvenJungle SvenAlgorithmic trading in PythonCredibilityWhat’s the best w...
-
4
Setup Ubuntu with NodeJS, MySQL, Nginx, Postgres, Ruby, Rails etc. Setup
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK