pat_org_domains.go
016_pat_org_domains.go - Overview
-
Overview This file defines a SQL migration to update the
personal_access_tokens
andorg_domains
tables. It adds anorg_id
column topersonal_access_tokens
, migrates data to a neworg_domains
table with a foreign key constraint onorg_id
, and migratescreated_at
andupdated_at
columns to timestamp types. It also drops theingestion_keys
table. -
Detailed Documentation
type updatePatAndOrgDomains
- Purpose: Represents the SQL migration for updating PATs and Org Domains.
- Parameters: None
- Returns: None
func NewUpdatePatAndOrgDomainsFactory
- Purpose: Creates a factory for producing
SQLMigration
instances related to updating PATs and Org Domains. - Parameters:
sqlstore
(sqlstore.SQLStore): The SQL store instance.
- Returns:
factory.ProviderFactory[SQLMigration, Config]
: A factory that producesSQLMigration
instances.
func newUpdatePatAndOrgDomains
- Purpose: Creates a new
updatePatAndOrgDomains
instance. - Parameters:
_
(context.Context): Context (not used)._
(factory.ProviderSettings): Provider settings (not used)._
(Config): Configuration (not used).store
(sqlstore.SQLStore): The SQL store instance.
- Returns:
(SQLMigration, error)
: A newupdatePatAndOrgDomains
instance and an error, if any.
func (*updatePatAndOrgDomains) Register
- Purpose: Registers the Up and Down migration functions.
- Parameters:
migrations
(*migrate.Migrations): The migrations manager.
- Returns:
error
: An error, if any.
func (*updatePatAndOrgDomains) Up
- Purpose: Executes the Up migration, performing schema changes and data migrations.
- Parameters:
ctx
(context.Context): The context.db
(*bun.DB): The database connection.
- Returns:
error
: An error, if any.
func (*updatePatAndOrgDomains) Down
- Purpose: Executes the Down migration (reverts the Up migration). This implementation is currently empty.
- Parameters:
ctx
(context.Context): The context.db
(*bun.DB): The database connection.
- Returns:
error
: An error, if any.
func updateOrgId
- Purpose: Updates the
org_domains
table to include a foreign key reference to theorganizations
table. - Parameters:
ctx
(context.Context): The context.tx
(bun.Tx): The database transaction.table
(string): The name of the table to update (expected to be "org_domains").
- Returns:
error
: An error, if any.
-
Code Examples N/A
-
Clarity and Accuracy The documentation reflects the code accurately.
-
Markdown & MDX Perfection The markdown syntax is correct.
-
Edge Cases To Avoid Breaking MDX No issues found.
-
Getting Started Relevance Include in Getting Started: NO