rusackas commented on PR #33720:
URL: https://github.com/apache/superset/pull/33720#issuecomment-2978330433

   Copilot's suggestions, FWIW:
   
   1. Migration Failure Fix
   Update the migration script to handle the foreign key constraint before 
dropping the column. Modify the script to drop the foreign key first and then 
the column:
   
   ```python
   from alembic import op
   import sqlalchemy as sa
   
   def upgrade():
       # Drop the foreign key constraint
       op.drop_constraint('slices_ibfk_1', 'slices', type_='foreignkey')
       # Drop the column
       op.drop_column('slices', 'druid_datasource_id')
   
   def downgrade():
       # Recreate the column (if needed during downgrade)
       op.add_column('slices', sa.Column('druid_datasource_id', sa.Integer(), 
nullable=True))
       # Recreate the foreign key constraint
       op.create_foreign_key('slices_ibfk_1', 'slices', 'druid_datasource', 
['druid_datasource_id'], ['id'])
   ```
   
   2. Test Failure Fix
   The OperationalError indicates that the position_json column does not 
support certain Unicode characters. Ensure the column uses a character set that 
supports all Unicode characters (e.g., utf8mb4 for MySQL).
   
   Steps:
   
   * Update the database schema:
     ```sql
     ALTER TABLE dashboards MODIFY COLUMN position_json TEXT CHARACTER SET 
utf8mb4 COLLATE utf8mb4_unicode_ci;
     ```
    * Ensure the database connection is configured to use utf8mb4: Modify the 
connection string in your configuration:
      ```python
     SQLALCHEMY_DATABASE_URI = 
"mysql+pymysql://<user>:<password>@<host>/<db_name>?charset=utf8mb4"
     ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to