Skip to content
This repository has been archived by the owner on Jun 27, 2018. It is now read-only.

Commit

Permalink
Merge pull request #39 from mozilla-services/rm-old-violations-table
Browse files Browse the repository at this point in the history
db: remove violation table SQL and migrations
  • Loading branch information
g-k committed Jan 23, 2017
2 parents eb945b0 + 2d56144 commit 6e80eb4
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,6 @@ const emptyReputationTableSQL = `
TRUNCATE TABLE reputation;
`

const createViolationReputationWeightsTableSQL = `
CREATE TABLE IF NOT EXISTS violation_reputation_weights (
violation_type varchar(128) PRIMARY KEY NOT NULL,
reputation int NOT NULL CHECK (reputation >= 0 AND reputation <= 100),
UNIQUE (violation_type, reputation)
);
`

const emptyViolationReputationWeightsTableSQL = `
TRUNCATE TABLE violation_reputation_weights;
`

// Close closes the database
func (db DB) Close() error {
err := db.reputationSelectStmt.Close()
Expand All @@ -123,10 +111,6 @@ func (db DB) CreateTables() error {
if err != nil {
return fmt.Errorf("Could not create reputation table: %s", err)
}
err = db.createViolationReputationWeightsTable()
if err != nil {
return fmt.Errorf("Could not create violation reputation weights table: %s", err)
}
return nil
}

Expand All @@ -136,10 +120,6 @@ func (db DB) EmptyTables() error {
if err != nil {
return fmt.Errorf("Could not truncate reputation table: %s", err)
}
err = db.emptyViolationReputationWeightsTable()
if err != nil {
return fmt.Errorf("Could not truncate violation reputation weights table: %s", err)
}
return nil
}

Expand All @@ -154,16 +134,6 @@ func (db DB) emptyReputationTable() error {
return err
}

func (db DB) createViolationReputationWeightsTable() error {
_, err := db.Query(createViolationReputationWeightsTableSQL)
return err
}

func (db DB) emptyViolationReputationWeightsTable() error {
_, err := db.Query(emptyViolationReputationWeightsTableSQL)
return err
}

// InsertOrUpdateReputationEntry inserts a single ReputationEntry into the database, and if it already exists, it updates it
func (db DB) InsertOrUpdateReputationEntry(tx *sql.Tx, entry ReputationEntry) error {
exec := db.Exec
Expand Down

0 comments on commit 6e80eb4

Please sign in to comment.