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

add a way to change indexes with migrations without alter table #148

Merged

Conversation

Garthi
Copy link
Contributor

@Garthi Garthi commented Aug 3, 2024

hi, here is a index update for the migrations working for MySQL, MariaDB, and PostgreSQL

the methods for the index migration is addIndex, dropIndex, and dropPrimaryIndex

here is a example

class UserTodoMigration5 extends Migration {
  @override
  void up(Schema schema) {
    schema.indexes('user_todo', (table) {
      table.dropIndex('user_id_index');
    });
  }

  @override
  void down(Schema schema) {
    schema.indexes('user_todo', (table) {
      table.addIndex('user_id_index', ['user_id'], IndexType.standardIndex);
    });
  }
}

@dukefirehawk dukefirehawk merged commit 9bb742d into dart-backend:master Aug 4, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants