mirror of
https://github.com/getredash/redash.git
synced 2025-12-19 17:37:19 -05:00
* Use 12-column layout for dashboard grid Set minSizeX, minSizeY for widgets to 2 since a value of 1 breaks all assumptions of the UI layout. Migration provide transition from 6 to 12 columns for all widgets. * Restyled by prettier
35 lines
934 B
Python
35 lines
934 B
Python
"""12-column dashboard layout
|
|
|
|
Revision ID: db0aca1ebd32
|
|
Revises: 1655999df5e3
|
|
Create Date: 2025-03-31 13:45:43.160893
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = 'db0aca1ebd32'
|
|
down_revision = '1655999df5e3'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
op.execute("""
|
|
UPDATE widgets
|
|
SET options = jsonb_set(options, '{position,col}', to_json((options->'position'->>'col')::int * 2)::jsonb);
|
|
UPDATE widgets
|
|
SET options = jsonb_set(options, '{position,sizeX}', to_json((options->'position'->>'sizeX')::int * 2)::jsonb);
|
|
""")
|
|
|
|
|
|
def downgrade():
|
|
op.execute("""
|
|
UPDATE widgets
|
|
SET options = jsonb_set(options, '{position,col}', to_json((options->'position'->>'col')::int / 2)::jsonb);
|
|
UPDATE widgets
|
|
SET options = jsonb_set(options, '{position,sizeX}', to_json((options->'position'->>'sizeX')::int / 2)::jsonb);
|
|
""")
|