Solucionado (ver solução)
Solucionado
(ver solução)
7
respostas

O banco de dados usado no curso é o SQLite? Posso alterar para o PGAdmin?

Tenho vivência no Postgres e gostaria de desenvolver o curso utilizando esse banco. Será que consigo acompanhar se alterar o banco?

7 respostas

Oi Guilherme, acho que você consegue sim. Vai ter que instalar o driver(potencial fonte de erros), mas acho que vai de boa. Se der algum problema, posta aqui e tentamos ajudar.

hahahahaaa.. OK Alberto. Você me indica algum vídeo ou tutorial para vincular o PGAdmin no Rails?

Olha se este te atende: https://www.youtube.com/watch?v=Rea2AjMgZXA

Olá estou com o seguinte erro ao tentar criar um banco com o comando rake db: create camisas

rake aborted! ActiveRecord::AdapterNotSpecified: 'development' database is not configured. Available: ["development", "adapter", "database", "username", "password", "host", "encoding", "test", "production"] Tasks: TOP => db:create

Já instalei o PG com o comando 'gem install pg' e mesmo assim não vai :(

Ele está reclamando que a configuração do arquivo de banco de dados, na parte de development, não está correto. Posta ele para a gente?

solução!

Oi Guilherme,

Você chegou a colocar a gem do Postgres no seu Gemfile?

Outra coisa, o database.yaml do Postgres tem um formato diferente do database.yaml do Mysql. Seria algo como:

# PostgreSQL. Versions 8.2 and up are supported.
#
# Install the pg driver:
#   gem install pg
# On OS X with Homebrew:
#   gem install pg -- --with-pg-config=/usr/local/bin/pg_config
# On OS X with MacPorts:
#   gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
#   gem install pg
#       Choose the win32 build.
#       Install PostgreSQL and put its /bin directory on your path.
#
# Configure Using Gemfile
# gem 'pg'
#
development:
  adapter: postgresql
  encoding: unicode
  database: NOMEDOPROJETO_development
  pool: 5
  username: postgres
  password:

  # Connect on a TCP socket. Omitted by default since the client uses a
  # domain socket that doesn't need configuration. Windows does not have
  # domain sockets, so uncomment these lines.
  #host: localhost

  # The TCP port the server listens on. Defaults to 5432.
  # If your server runs on a different port number, change accordingly.
  #port: 5432

  # Schema search path. The server defaults to $user,public
  #schema_search_path: myapp,sharedapp,public

  # Minimum log levels, in increasing order:
  #   debug5, debug4, debug3, debug2, debug1,
  #   log, notice, warning, error, fatal, and panic
  # Defaults to warning.
  #min_messages: notice

# 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: postgresql
  encoding: unicode
  database: NOMEDOPROJETO_test
  pool: 5
  username: postgres
  password:

production:
  adapter: postgresql
  encoding: unicode
  database: NOMEDOPROJETO_production
  pool: 5
  username: postgres
  password:

Abraço!

Olá Joviane e Alberto tudo bem? Muito obrigado pela ajuda.

Vou detalhar o que fiz. esta é minha Gemfile

gem 'rails', '~> 5.0.0', '>= 5.0.0.1' gem 'pg' gem 'jquery-rails' gem 'turbolinks', '~> 5' gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

e no meu terminal utilizei o bundle install e me retornou a seguinte mensagem

Installing rails 5.0.2 Bundle complete! 5 Gemfile dependencies, 43 gems now installed. Use bundle show [gemname] to see where a bundled gem is installed. Post-install message from nokogiri: Nokogiri is built with the packaged libraries: libxml2-2.9.4, libxslt-1.1.29, zlib-1.2.8, libiconv-1.14.

e essa é minha database.yml

development: adapter: postgresql encoding: unicode database: lojadecamisetas pool: 5 username: postgres password: postgres

test: adapter: postgresql encoding: unicode database: lojadecamisetas pool: 5 username: postgres password: postgres

production: adapter: postgresql encoding: unicode database: lojadecamisetas pool: 5 username: postgres password: postgres

Iniciei o servidor com comando rails server no meu terminal e deu tudo certo! Nossa muito obrigado. Gostaria de ter conhecido a Alura antes! :)

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software