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

[WIP] add schema to unique constraint #5936

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ class SqlaTable(Model, BaseDatasource):
column_class = TableColumn

__tablename__ = 'tables'
__table_args__ = (UniqueConstraint('database_id', 'table_name'),)
__table_args__ = (UniqueConstraint('database_id', 'schema', 'table_name'),)

table_name = Column(String(250))
main_dttm_col = Column(String(250))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""add one more constraint

Revision ID: d6a223d2332a
Revises: 55e910a74826
Create Date: 2018-09-19 16:51:55.900887

"""

# revision identifiers, used by Alembic.
revision = 'd6a223d2332a'
down_revision = '55e910a74826'

from alembic import op


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_unique_constraint(None, 'tables', ['database_id', 'schema', 'table_name'])
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'tables', type_='unique')
# ### end Alembic commands ###