You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Hi Joseph, the recent change to the ORM to allow indexes to be named does not seem to work for unique() - the name I specify is always ignored. index() on the other hand works fine. I tried diving down into the code down to the Table.py class, but I could not see anything obviously wrong.
To Reproduce
For example, as a side project I have started a rewrite of an old (2005) online game of mine. Here is a simplified version (stripped to just the pertinent fields) of the migration for the games table:
...
classCreateGamesTable(Migration):
defup(self):
""" Run the migrations. """withself.schema.create("games") astable:
table.increments("id")
table.string("game_title", length=255, nullable=False)
table.timestamps()
# table.index(column="game_title", name="ix_games_game_title") # <= this works when uncommentedtable.unique(column="game_title", name="uq_games_game_title") # <= this does not
...
Expected behavior
What do you believe should be happening?
The field games.game_title should have a unique index on it called uq_games_games_title
However, although it does have a unique index, it's ignoring the supplied name and using the default:
SELECT DISTINCT
TABLE_NAME,
COLUMN_NAME,
INDEX_NAME
FROMINFORMATION_SCHEMA.STATISTICSWHERE TABLE_SCHEMA ='new_dev'AND TABLE_NAME='games';
TABLE_NAME COLUMN_NAME INDEX_NAME
games game_title games_game_title_unique
games id PRIMARY
Desktop (please complete the following information):
OS: macOS
Version 10.14.6
What database are you using?
Type: MySQL
Version 8.0.21
Masonite ORM 1.0.52
PyMySQL 1.0.2
Python 3.9.6
Additional context
N/A
The text was updated successfully, but these errors were encountered:
Describe the bug
Hi Joseph, the recent change to the ORM to allow indexes to be named does not seem to work for
unique()
- the name I specify is always ignored.index()
on the other hand works fine. I tried diving down into the code down to theTable.py
class, but I could not see anything obviously wrong.To Reproduce
For example, as a side project I have started a rewrite of an old (2005) online game of mine. Here is a simplified version (stripped to just the pertinent fields) of the migration for the games table:
Expected behavior
What do you believe should be happening?
The field
games.game_title
should have a unique index on it calleduq_games_games_title
However, although it does have a unique index, it's ignoring the supplied name and using the default:
Desktop (please complete the following information):
What database are you using?
Type: MySQL
Version 8.0.21
Masonite ORM 1.0.52
PyMySQL 1.0.2
Python 3.9.6
Additional context
N/A
The text was updated successfully, but these errors were encountered: