-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
63 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,32 @@ | ||
package gnidump | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
"github.com/gnames/gnidump/rebuild" | ||
"github.com/gnames/gnsys" | ||
) | ||
|
||
func (gnd GNIdump) PopulatePG() error { | ||
var err error | ||
log.Printf("Rebuilding '%s' database.\n", gnd.PgDB.PgDB) | ||
if err = gnd.ResetDB(); err != nil { | ||
return fmt.Errorf("reset of DB did not work: %w", err) | ||
} | ||
if err = gnd.Migrate(); err != nil { | ||
return fmt.Errorf("cannot rebuild DB schema: %w", err) | ||
} | ||
// var err error | ||
// log.Printf("Rebuilding '%s' database.\n", gnd.PgDB.PgDB) | ||
// if err = gnd.ResetDB(); err != nil { | ||
// return fmt.Errorf("reset of DB did not work: %w", err) | ||
// } | ||
// if err = gnd.Migrate(); err != nil { | ||
// return fmt.Errorf("cannot rebuild DB schema: %w", err) | ||
// } | ||
rb := rebuild.NewRebuild(gnd.PgDB, gnd.InputDir, gnd.JobsNum) | ||
if err = gnsys.MakeDir(rb.ParserKeyValDir); err != nil { | ||
return err | ||
} | ||
if err = rb.UploadNameString(); err != nil { | ||
return fmt.Errorf("unable to populate name_strings table: %w", err) | ||
} | ||
if err = rb.UploadDataSources(); err != nil { | ||
return fmt.Errorf("unable to populate data_sources table: %w", err) | ||
} | ||
|
||
rb.UploadNameStringIndices() | ||
rb.RemoveOrphans() | ||
rb.CreateWords() | ||
// if err = gnsys.MakeDir(rb.ParserKeyValDir); err != nil { | ||
// return err | ||
// } | ||
// if err = rb.UploadNameString(); err != nil { | ||
// return fmt.Errorf("unable to populate name_strings table: %w", err) | ||
// } | ||
// if err = rb.UploadDataSources(); err != nil { | ||
// return fmt.Errorf("unable to populate data_sources table: %w", err) | ||
// } | ||
// | ||
// rb.UploadNameStringIndices() | ||
// rb.RemoveOrphans() | ||
// rb.CreateWords() | ||
rb.VerificationView() | ||
return nil | ||
} |
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
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