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

Indexes are not created for MySQL during migration when included in ModelDefinition #2723

Closed
Narrator opened this issue Apr 10, 2019 · 1 comment

Comments

@Narrator
Copy link

Narrator commented Apr 10, 2019

Description / Steps to reproduce

Use the MySQL datasource, and define indexes in the model definition like so and run migration

@model({
    indexes: {
        uniqueIndex: {
            keys: {
                property: 1,
                anotherProperty: 1
            }
        }
    }
})

Current Behavior

The indexes are not actually created in the database

Expected Behavior

Indexes are created in the database

@bajtos
Copy link
Member

bajtos commented Apr 11, 2019

IIRC, model-level settings must be nested in settings object, see #2142

@model({
  settings: {
    indexes: {
        uniqueIndex: {
            keys: {
                property: 1,
                anotherProperty: 1
            }
        }
    }
  }
})

I am looking into ways how to make index and foreign key definition more ergonomic, see #2606

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

No branches or pull requests

2 participants