Skip to main content

pat_update.go

020_pat_update.go - Overview

  1. 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.

  2. 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 the updatePat migration.
  • Parameters:
    • sqlstore (sqlstore.SQLStore): An SQLStore instance used by the migration.
  • Returns:
    • factory.ProviderFactory[SQLMigration, Config]: A factory for creating SQLMigration 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 the updatePat 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): The migrate.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