Skip to content

Commit

Permalink
fix: remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nityanandagohain committed Feb 18, 2025
1 parent 2bb4726 commit cf6c549
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions pkg/sqlmigration/012_modify_org_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ func (migration *modifyOrgDomain) Register(migrations *migrate.Migrations) error
}

func (migration *modifyOrgDomain) Up(ctx context.Context, db *bun.DB) error {
// only run this for old sqlite db
if db.Dialect().Name().String() != "sqlite" {
return nil
}

// begin transaction
tx, err := db.BeginTx(ctx, nil)
if err != nil {
Expand All @@ -44,12 +39,10 @@ func (migration *modifyOrgDomain) Up(ctx context.Context, db *bun.DB) error {
return err
}

// cannot add not null constraint to the column
if _, err := tx.ExecContext(ctx, `ALTER TABLE org_domains ADD COLUMN updated_at INTEGER`); err != nil {
return err
}

// update the new column with the value of the old column
if _, err := tx.ExecContext(ctx, `UPDATE org_domains SET updated_at = CAST(updated_at_old AS INTEGER)`); err != nil {
return err
}
Expand Down

0 comments on commit cf6c549

Please sign in to comment.