pat_update.go
020_pat_update.go - Overview
-
Overview This file defines a SQL migration to update the
personal_access_tokens
table by adding NOT NULL constraints with default values to specific columns. -
Detailed Documentation
type updatePat
- Purpose: Represents a migration to update the
personal_access_tokens
table. - Parameters: None
- Returns: None
func NewUpdatePatFactory
- Purpose: Creates a new
factory.ProviderFactory
for theupdatePat
migration. - Parameters:
sqlstore
(sqlstore.SQLStore): An SQLStore instance used by the migration.
- Returns:
factory.ProviderFactory[SQLMigration, Config]
: A factory for creatingSQLMigration
instances.
func newUpdatePat
- Purpose: Creates a new
updatePat
instance. - Parameters:
_
(context.Context): Context (unused)._
(factory.ProviderSettings): Provider settings (unused)._
(Config): Configuration (unused).store
(sqlstore.SQLStore): The SQLStore instance to use.
- Returns:
SQLMigration
: An instance of theupdatePat
migration.error
: An error, if any occurred.
func (migration *updatePat) Register
- Purpose: Registers the Up and Down migration functions with the
migrate.Migrations
object. - Parameters:
migrations
(*migrate.Migrations): Themigrate.Migrations
object to register with.
- Returns:
error
: An error, if any occurred during registration.
func (migration *updatePat) Up
- Purpose: Implements the Up migration logic, adding NOT NULL constraints and default values to columns in the
personal_access_tokens
table. - Parameters:
ctx
(context.Context): The context for the operation.db
(*bun.DB): The bun database instance.
- Returns:
error
: An error, if any occurred during the migration.
func (migration *updatePat) Down
- Purpose: Implements the Down migration logic (currently empty).
- Parameters:
ctx
(context.Context): The context for the operation.db
(*bun.DB): The bun database instance.
- Returns:
error
: An error, if any occurred during the migration.
Include in Getting Started: NO