<commit_before>package main

import (
	"fmt"
	"html/template"
	"os"
	"time"

	log "github.com/Sirupsen/logrus"
	"github.com/jinzhu/gorm"
	_ "github.com/lib/pq"
)

type Sms struct {
	ID          int
	Timestamp   time.Time
	From        string
	Message     string        `sql:"type:text"`
	MessageHTML template.HTML `sql:"-" json:"-"`
	Hash        string        `sql:"type:char(64);unique_index"`
}

func InitDB() *gorm.DB {
	log.Debug("Initialising database...")

	database := os.Getenv("SMS_DATABASE")
	user := os.Getenv("SMS_DBUSER")
	pass := <PASSWORD>("<PASSWORD>")
	host := os.Getenv("SMS_DBHOST")

	if database == "" || user == "" || pass == "" {
		log.Fatal("Missing database environment variable")
	}

	if host == "" {
		host = "127.0.0.1"
	}

	db, err := gorm.Open("postgres", fmt.Sprintf("user=%s password=%s dbname=%s host=%s sslmode=disable", user, pass, database, host))
	if err != nil {
		log.Fatalf("Error connecting to database: %s", err)
	}

	db.AutoMigrate(&Sms{})

	return &db
}<commit_msg>Fix for updated gorm library<commit_after>package main

import (
	"fmt"
	"html/template"
	"os"
	"time"

	log "github.com/Sirupsen/logrus"
	"github.com/jinzhu/gorm"
	_ "github.com/lib/pq"
)

type Sms struct {
	ID          int
	Timestamp   time.Time
	From        string
	Message     string        `sql:"type:text"`
	MessageHTML template.HTML `sql:"-" json:"-"`
	Hash        string        `sql:"type:char(64);unique_index"`
}

func InitDB() *gorm.DB {
	log.Debug("Initialising database...")

	database := os.Getenv("SMS_DATABASE")
	user := os.Getenv("SMS_DBUSER")
	pass := os.Getenv("SMS_DBPASS")
	host := os.Getenv("SMS_DBHOST")

	if database == "" || user == "" || pass == "" {
		log.Fatal("Missing database environment variable")
	}

	if host == "" {
		host = "127.0.0.1"
	}

	db, err := gorm.Open("postgres", fmt.Sprintf("user=%s password=%s dbname=%s host=%s sslmode=disable", user, pass, database, host))
	if err != nil {
		log.Fatalf("Error connecting to database: %s", err)
	}

	db.AutoMigrate(&Sms{})

	return db
}
{'fraction_non_alphanumeric': 0.179575727676369, 'fraction_numerical': 0.007893438579181056, 'mean_word_length': 3.4669603524229076, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5018631', 'n_tokens_mistral': 790, 'n_tokens_neox': 760, 'n_words': 162}