Create a new Database in your current project :: R sir

Step by Step ::

01:: Change the database name in database.yml

02:: Download Sql file and put it in the folder outside of your root directory

03 :: rake db:Create 

04 ::  $ psql -U postgres databasename < .sql file name 

05 :: 



1. Change the name of database in development and test :

......................................................................................................................

development:

  <<: *default

  adapter: postgresql

  database: 'chingchingbyakon_dev11'

  username: 'postgres'

  password: 'postgres'

  host: <%= ENV['TEMPLATE_DATABASE_HOSTNAME'] || 'localhost'%>


2. Download the sql file  and put that in your folder outside the root directory

3. rake db:create 

4. rake db:migrate

5. Use the below command ::

psql -U database_name <  sql_file_name

database_name :: you can have this by your own choice 

sql_file_name :: you can have this by your sql file name 

$ psql -U postgres chingchingbyakon_dev11 < local_16_06_2022.sql

......................................................................................................................

development:

  <<: *default

  adapter: postgresql

  database: 'chingchingbyakon_dev11'

  username: 'postgres'

  password: 'postgres'

  host: <%= ENV['TEMPLATE_DATABASE_HOSTNAME'] || 'localhost'%>

Comments

Popular posts from this blog

Rails 7 Features :: Comparison with Rails 6 and Rails 5