Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancing GORM: Proposal for Migration Hooks #7227

Open
MuhmdHsn313 opened this issue Oct 6, 2024 · 0 comments
Open

Enhancing GORM: Proposal for Migration Hooks #7227

MuhmdHsn313 opened this issue Oct 6, 2024 · 0 comments
Assignees
Labels
type:feature_request feature request

Comments

@MuhmdHsn313
Copy link

Describe the feature

I propose the introduction of migration hooks within GORM, enabling developers to execute custom logic or SQL commands before and after migrations. Hooks such as BeforeMigrate, AfterMigrate ..etc would facilitate handling complex migration scenarios, including the creation of enums, data modifications, and conditional execution of SQL commands based on the existing database state.

Motivation

The current GORM framework offers lifecycle hooks for model events but lacks specific hooks for migrations. This absence can complicate the management of intricate migrations that require additional logic or setup procedures. Implementing migration hooks would provide developers with enhanced flexibility and control over database schema changes, leading to cleaner, more maintainable migration code. Such a feature would significantly improve the usability of GORM in larger projects with complex database architectures.

Related Issues

@github-actions github-actions bot added the type:feature_request feature request label Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature_request feature request
Projects
None yet
Development

No branches or pull requests

2 participants