add_licenses.go
008_add_licenses.go - Overview
- Overview
This file defines a SQL migration that creates four tables: licenses
, sites
, feature_status
, and licenses_v3
if they do not already exist. The Up
function creates the tables, while the Down
function currently does nothing (no rollback).
- Detailed Documentation
addLicenses
- Purpose: Represents the SQL migration for adding license-related tables.
NewAddLicensesFactory
- Purpose: Creates a new factory for the
addLicenses
SQL migration. - Returns: A
factory.ProviderFactory[SQLMigration, Config]
that can createaddLicenses
instances.
newAddLicenses
- Purpose: Creates a new
addLicenses
instance. - Parameters:
_
:context.Context
- Context, not used in the function._
:factory.ProviderSettings
- Factory provider settings, not used in the function._
:Config
- Configuration, not used in the function.
- Returns:
SQLMigration
: A newaddLicenses
instance.error
: Returnsnil
.
(*addLicenses) Register
- Purpose: Registers the
Up
andDown
migration functions. - Parameters:
migrations
:*migrate.Migrations
- The migration manager.
- Returns:
error
: An error if registration fails, otherwisenil
.
(*addLicenses) Up
- Purpose: Executes the "up" migration, creating the
licenses
,sites
,feature_status
, andlicenses_v3
tables if they don't exist. - Parameters:
ctx
:context.Context
- The context for the operation.db
:*bun.DB
- The database connection.
- Returns:
error
: An error if table creation fails, otherwisenil
.
(*addLicenses) Down
- Purpose: Executes the "down" migration (rollback). Currently, it does nothing.
- Parameters:
ctx
:context.Context
- The context for the operation.db
:*bun.DB
- The database connection.
- Returns:
error
: Always returnsnil
.
Include in Getting Started: NO