aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/db_select.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v5/db_select.rb')
-rw-r--r--lib/sisu/v5/db_select.rb24
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/sisu/v5/db_select.rb b/lib/sisu/v5/db_select.rb
index 898dcb71..d52df2bf 100644
--- a/lib/sisu/v5/db_select.rb
+++ b/lib/sisu/v5/db_select.rb
@@ -79,15 +79,27 @@ module SiSU_DbSelect
end
def db_exist?
if @sql_type==:sqlite \
- and (not (FileTest.file?(@db.sqlite.db)) or FileTest.zero?(@db.sqlite.db))
- puts %{no connection with #{@sql_type} database established, createdb "#{@db.sqlite.db}"?}
+ and (not (FileTest.file?(@db.sqlite.db)) \
+ or FileTest.zero?(@db.sqlite.db))
+ puts %{no connection with #{@sql_type} database established, you may need to run:\n} \
+ + %{ sisu --#{@sql_type} --createall\n} \
+ + %{ before attempting to populate the database}
exit
end
if @conn.is_a?(NilClass)
- db=@sql_type==:sqlite \
- ? @db.sqlite.db
- : @db.psql.db
- puts %{no connection with #{@sql_type} database established, createdb "#{db}"?}
+ db=if @sql_type==:sqlite
+ puts %{no connection with #{@sql_type} database established, you may need to run:\n} \
+ + %{ sisu --#{@sql_type} --createall\n} \
+ + %{ before attempting to populate the database}
+ @db.sqlite.db
+ else
+ puts %{no connection with #{@sql_type} database established, you may need to run:\n} \
+ + %{ createdb "#{@db.psql.db}"\n} \
+ + %{ after that don't forget to run:\n} \
+ + %{ sisu --#{@sql_type} --createall\n} \
+ + %{ before attempting to populate the database}
+ @db.psql.db
+ end
exit
end
end