diff options
Diffstat (limited to 'lib/sisu/v5/db_select.rb')
-rw-r--r-- | lib/sisu/v5/db_select.rb | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/lib/sisu/v5/db_select.rb b/lib/sisu/v5/db_select.rb index 3f232c14..26bbd3da 100644 --- a/lib/sisu/v5/db_select.rb +++ b/lib/sisu/v5/db_select.rb @@ -91,22 +91,45 @@ module SiSU_DbSelect 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, you may need to run:\n} \ - + %{ sisu --#{@sql_type} --createall\n} \ + puts %{no connection with sqlite database established, you may need to run:\n} \ + + %{ sisu --sqlite --createall\n} \ + %{ before attempting to populate the database} - exit + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).mark( + "\n" \ + + 'Attempting to initialize db' + "\n" \ + + 'Creating db tables' + ) + @sdb.create_table.metadata_and_text + @sdb.create_table.doc_objects + @sdb.create_table.endnotes + @sdb.create_table.endnotes_asterisk + @sdb.create_table.endnotes_plus + @sdb.create_table.urls + @sdb_index.create_indexes end if @conn.is_a?(NilClass) - db=if @sql_type==:sqlite - puts %{no connection with #{@sql_type} database established, you may need to run:\n} \ - + %{ sisu --#{@sql_type} --createall\n} \ + if @sql_type==:sqlite + puts %{no connection with sqlite database established, you may need to run:\n} \ + + %{ sisu --sqlite --createall\n} \ + %{ before attempting to populate the database} + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).mark( + "\n" \ + + 'Attempting to initialize db' + "\n" \ + + 'Creating db tables' + ) + @sdb.create_table.metadata_and_text + @sdb.create_table.doc_objects + @sdb.create_table.endnotes + @sdb.create_table.endnotes_asterisk + @sdb.create_table.endnotes_plus + @sdb.create_table.urls + @sdb_index.create_indexes @db.sqlite.db else - puts %{no connection with #{@sql_type} database established, you may need to run:\n} \ + puts %{no connection with pg 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} \ + + %{ sisu --pg --createall\n} \ + %{ before attempting to populate the database} @db.psql.db end |