
# revision identifiers, used by Alembic.
revision = '266658781c00'
down_revision = '204aae05372a'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql


def upgrade():
    op.alter_column('equipments_provider', 'instances', existing_type=postgresql.ARRAY(sa.TEXT()), nullable=True)


def downgrade():
    op.alter_column(
        'equipments_provider', 'instances', existing_type=postgresql.ARRAY(sa.TEXT()), nullable=False
    )


# revision identifiers, used by Alembic.
revision = '266658781c00'
down_revision = '204aae05372a'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql


def upgrade():
    op.alter_column('equipments_provider', 'instances', existing_type=postgresql.ARRAY(sa.TEXT()), nullable=True)


def downgrade():
    op.execute("UPDATE equipments_provider SET instances = '{null_instance}';")
    op.alter_column(
        'equipments_provider', 'instances', existing_type=postgresql.ARRAY(sa.TEXT()), nullable=False
    )

Add required default value before downgrade migration
Add required default value before downgrade migration

  
  # revision identifiers, used by Alembic.
  revision = '266658781c00'
  down_revision = '204aae05372a'
  
  from alembic import op
  import sqlalchemy as sa
  from sqlalchemy.dialects import postgresql
  
  
  def upgrade():
      op.alter_column('equipments_provider', 'instances', existing_type=postgresql.ARRAY(sa.TEXT()), nullable=True)
  
  
  def downgrade():
+     op.execute("UPDATE equipments_provider SET instances = '{null_instance}';")
      op.alter_column(
          'equipments_provider', 'instances', existing_type=postgresql.ARRAY(sa.TEXT()), nullable=False
      )
  
Add required default value before downgrade migration
## Code Before:

# revision identifiers, used by Alembic.
revision = '266658781c00'
down_revision = '204aae05372a'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql


def upgrade():
    op.alter_column('equipments_provider', 'instances', existing_type=postgresql.ARRAY(sa.TEXT()), nullable=True)


def downgrade():
    op.alter_column(
        'equipments_provider', 'instances', existing_type=postgresql.ARRAY(sa.TEXT()), nullable=False
    )

## Instruction:
Add required default value before downgrade migration
## Code After:

# revision identifiers, used by Alembic.
revision = '266658781c00'
down_revision = '204aae05372a'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql


def upgrade():
    op.alter_column('equipments_provider', 'instances', existing_type=postgresql.ARRAY(sa.TEXT()), nullable=True)


def downgrade():
    op.execute("UPDATE equipments_provider SET instances = '{null_instance}';")
    op.alter_column(
        'equipments_provider', 'instances', existing_type=postgresql.ARRAY(sa.TEXT()), nullable=False
    )
