-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix postgresql database naming convention (#332)
* Add test for generating and app with postgres * Add test for database url in environment yaml files * Add tests for database urls and names generated for docker-compose.yml * Replace '-' with '_' for postgresql database names * Switch default postgresql username to postgres in database.yml * Name databases consistently for pg, mysql, sqlite * Test Amber::CLI::App directly for database naming * Use 'database_name_base' property in all parts of docker-compose.yml
- Loading branch information
1 parent
7e422db
commit 69716c4
Showing
9 changed files
with
120 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require "../../../spec_helper" | ||
|
||
module Amber::CLI | ||
describe App do | ||
pg_app = App.new("sample-app") | ||
mysql_app = App.new("sample-app", "mysql") | ||
sqlite_app = App.new("sample-app", "sqlite") | ||
|
||
describe "#database_name_base" do | ||
it "should return a postgres compatible name" do | ||
pg_app.database_name_base.should_not contain "-" | ||
end | ||
|
||
it "should return a consistent name for all db types" do | ||
mysql_app.database_name_base.should eq pg_app.database_name_base | ||
sqlite_app.database_name_base.should eq pg_app.database_name_base | ||
end | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<%= @database %>: | ||
<% case @database | ||
when "mysql" -%> | ||
database: mysql://root@localhost:3306/<%= "#{@name}_development" %> | ||
database: mysql://root@localhost:3306/<%= "#{database_name_base}_development" %> | ||
<% when "pg" -%> | ||
database: postgres://root:@localhost:5432/<%= "#{@name}_development" %> | ||
database: postgres://postgres:@localhost:5432/<%= "#{database_name_base}_development" %> | ||
<% when "sqlite" -%> | ||
database: sqlite3:./db/<%= "#{@name}_development" %>.db | ||
database: sqlite3:./db/<%= "#{database_name_base}_development" %>.db | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters