datamigration.go
datamigration.go - Overview
-
Overview Defines the
DataMigration
struct, which represents a database table for tracking data migrations. It includes fields for ID, version, creation timestamp, and success status. -
Detailed Documentation
DataMigration
- Purpose: Represents a data migration record in the database.
- Fields:
bun.BaseModel
(bun.BaseModel): Provides base model functionality for bun ORM. It is tagged withbun:"table:data_migrations"
to map to thedata_migrations
table in the database.ID
(int): The unique identifier for the migration record. It is tagged withbun:"id,pk,autoincrement"
to define it as the primary key and auto-incrementing.Version
(string): The version string of the migration. It is tagged withbun:"version,unique,notnull,type:VARCHAR(255)"
to ensure uniqueness, non-nullability, and a VARCHAR(255) type in the database.CreatedAt
(time.Time): The timestamp when the migration record was created. It is tagged withbun:"created_at,notnull,default:current_timestamp"
to set it as non-nullable and default to the current timestamp.Succeeded
(bool): Indicates whether the migration was successful. It is tagged withbun:"succeeded,notnull,default:false"
to set it as non-nullable and default to false.
-
Code Examples None
-
Clarity and Accuracy The documentation reflects the code accurately.
-
Markdown & MDX Perfection The markdown is correctly formatted.
-
Edge Cases To Avoid Breaking MDX No issues.
-
Getting Started Relevance Include in Getting Started: NO