hmn/src/migration/migrations/2021-03-28T152630Z_AllowLon...

44 lines
976 B
Go
Raw Normal View History

package migrations
import (
"context"
"time"
"git.handmade.network/hmn/hmn/src/migration/types"
"github.com/jackc/pgx/v4"
)
func init() {
registerMigration(AllowLongerPasswordHashes{})
}
type AllowLongerPasswordHashes struct{}
func (m AllowLongerPasswordHashes) Version() types.MigrationVersion {
return types.MigrationVersion(time.Date(2021, 3, 28, 15, 26, 30, 0, time.UTC))
}
func (m AllowLongerPasswordHashes) Name() string {
return "AllowLongerPasswordHashes"
}
func (m AllowLongerPasswordHashes) Description() string {
return "Increase the storage size limit on hashed passwords"
}
func (m AllowLongerPasswordHashes) Up(tx pgx.Tx) error {
_, err := tx.Exec(context.Background(), `
ALTER TABLE auth_user
ALTER COLUMN password TYPE VARCHAR(256)
`)
return err
}
func (m AllowLongerPasswordHashes) Down(tx pgx.Tx) error {
_, err := tx.Exec(context.Background(), `
ALTER TABLE auth_user
ALTER COLUMN password TYPE VARCHAR(128)
`)
return err
}