def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( 'users', sa.Column('dish_name', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) op.add_column( 'users', sa.Column('dish_url', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) op.add_column( 'users', sa.Column('dish_bitmap', postgresql.BYTEA(), autoincrement=False, nullable=True))
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('upload_medical_records', 'type_doc', existing_type=postgresql.ENUM('Invoice', 'Prescription', 'Report', name='type_enum'), nullable=True) op.alter_column('upload_medical_records', 'treat_id', existing_type=sa.INTEGER(), nullable=True) op.alter_column('upload_medical_records', 'date', existing_type=sa.DATE(), nullable=True) op.alter_column('upload_medical_records', 'File', existing_type=postgresql.BYTEA(), nullable=True) op.drop_column('upload_medical_records', 'filename')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'users', type_='unique') op.drop_column('candidates', 'first_working_day') op.create_table( 'apscheduler_jobs', sa.Column('id', sa.VARCHAR(length=191), autoincrement=False, nullable=False), sa.Column('next_run_time', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True), sa.Column('job_state', postgresql.BYTEA(), autoincrement=False, nullable=False), sa.PrimaryKeyConstraint('id', name='apscheduler_jobs_pkey')) op.create_index('ix_apscheduler_jobs_next_run_time', 'apscheduler_jobs', ['next_run_time'], unique=False)
def upgrade(): op.create_index( 'ind_login_lower_email', 'login', [ sa.text('(lower(email COLLATE "C"))'), ], unique=False, ) op.drop_table('forgotpassword') op.create_table( 'forgotpassword', sa.Column('token_sha256', postgresql.BYTEA(), nullable=False), sa.Column('email', sa.String(length=254), nullable=False), sa.Column('created_at', postgresql.TIMESTAMP(timezone=True), server_default=sa.text(u'now()'), nullable=False), sa.PrimaryKeyConstraint('token_sha256')) op.create_index('ind_forgotpassword_created_at', 'forgotpassword', ['created_at'], unique=False) op.create_table( 'user_events', sa.Column('eventid', sa.Integer(), nullable=False), sa.Column('userid', sa.Integer(), nullable=False), sa.Column('event', sa.String(length=100), nullable=False), sa.Column('data', postgresql.JSONB(astext_type=sa.Text()), nullable=False), sa.Column('occurred', postgresql.TIMESTAMP(timezone=True), server_default=sa.text(u'now()'), nullable=False), sa.ForeignKeyConstraint( ['userid'], ['login.userid'], ), sa.PrimaryKeyConstraint('eventid')) op.create_index('ind_user_events_userid_eventid', 'user_events', ['userid', 'eventid'], unique=False)
def upgrade(): op.create_table('users', sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('users_id_seq'::regclass)"), autoincrement=True, nullable=False), sa.Column('username', sa.VARCHAR(length=64), autoincrement=False, nullable=True), sa.Column('hash', postgresql.BYTEA(), autoincrement=False, nullable=False), sa.PrimaryKeyConstraint('id', name='users_pkey'), postgresql_ignore_search_path=False ) op.create_index('ix_users_username', 'users', ['username'], unique=True) op.create_table('posts', sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), sa.Column('body', sa.VARCHAR(length=1000), autoincrement=False, nullable=False), sa.Column('timestamp', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='posts_user_id_fkey'), sa.PrimaryKeyConstraint('id', name='posts_pkey') ) op.create_index('ix_posts_timestamp', 'posts', ['timestamp'], unique=False) op.create_table('user_log_entries', sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), sa.Column('timestamp', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('method', sa.VARCHAR(), autoincrement=False, nullable=True), sa.Column('url', sa.VARCHAR(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='user_log_entries_user_id_fkey'), sa.PrimaryKeyConstraint('id', name='user_log_entries_pkey') ) op.create_index('ix_user_log_entries_url', 'user_log_entries', ['url'], unique=False) op.create_index('ix_user_log_entries_timestamp', 'user_log_entries', ['timestamp'], unique=False) op.create_table('likes', sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('post_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('timestamp', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['post_id'], ['posts.id'], name='likes_post_id_fkey'), sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='likes_user_id_fkey'), sa.PrimaryKeyConstraint('id', name='likes_pkey'), ) op.create_index('ix_likes_timestamp', 'likes', ['timestamp'], unique=False)
def upgrade(): op.add_column( 'data_sources', sa.Column('encrypted_options', postgresql.BYTEA(), nullable=True)) # copy values data_sources = table( 'data_sources', sa.Column('id', sa.Integer, primary_key=True), sa.Column( 'encrypted_options', ConfigurationContainer.as_mutable( EncryptedConfiguration(sa.Text, settings.SECRET_KEY, FernetEngine))), sa.Column('options', ConfigurationContainer.as_mutable(Configuration))) conn = op.get_bind() for ds in conn.execute(data_sources.select()): conn.execute(data_sources.update().where( data_sources.c.id == ds.id).values(encrypted_options=ds.options)) op.drop_column('data_sources', 'options') op.alter_column('data_sources', 'encrypted_options', nullable=False)
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'question_number', sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), sa.Column('question_number', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('question_image', postgresql.BYTEA(), autoincrement=False, nullable=True), sa.Column('image_width', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('image_height', sa.INTEGER(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='question_number_pkey')) op.drop_table('questionnumber')
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'product', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.Text(), nullable=False), sa.Column('author', sa.Text(), nullable=False), sa.Column('category', sa.Text(), nullable=False), sa.Column('description', sa.Text(), nullable=True), sa.Column('image', postgresql.BYTEA(), nullable=True), sa.Column('price', postgresql.MONEY(), nullable=False), sa.Column('stock', sa.Integer(), server_default='0', nullable=False), sa.Column('rating', sa.Float(), nullable=True), sa.Column('reviews', sa.Integer(), server_default='0', nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False), sa.PrimaryKeyConstraint('id')) op.create_index(op.f('ix_product_id'), 'product', ['id'], unique=False) op.create_index(op.f('ix_product_name'), 'product', ['name'], unique=True)
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( u'teaminjectsubmissionattachments', sa.Column('filename', sa.VARCHAR(length=255), autoincrement=False, nullable=False)) op.add_column( u'teaminjectsubmissionattachments', sa.Column('data', postgresql.BYTEA(), autoincrement=False, nullable=False)) op.add_column( u'teaminjectsubmissionattachments', sa.Column('size', sa.INTEGER(), autoincrement=False, nullable=False)) op.drop_constraint(None, 'teaminjectsubmissionattachments', type_='foreignkey') op.drop_column(u'teaminjectsubmissionattachments', 'attachment_id') op.drop_index(op.f('ix_attachments_id'), table_name='attachments') op.drop_table('attachments')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( 'players', sa.Column('ability', sa.String(length=50), autoincrement=False, nullable=True)) op.add_column( 'players', sa.Column('rank_points', sa.INTEGER(), autoincrement=False, nullable=True)) op.add_column( 'players', sa.Column('sport', sa.String(length=30), autoincrement=False, nullable=True)) op.alter_column('players', 'profile_image', existing_type=postgresql.BYTEA(), nullable=True)
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('accounts', 'pw_hash', existing_type=postgresql.BYTEA(), nullable=False)
def downgrade(): op.add_column('metrics_request_v2', sa.Column('serialized', postgresql.BYTEA(), autoincrement=False, nullable=True))
def upgrade(): op.add_column( 'submission', sa.Column('image_representations', postgresql.BYTEA(), nullable=True))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'canceled_formal_offer_signal', sa.Column('inserted_at_ts', sa.TIMESTAMP(timezone=True), nullable=False), sa.Column('payee_creditor_id', sa.BigInteger(), nullable=False), sa.Column('offer_id', sa.BigInteger(), nullable=False), sa.PrimaryKeyConstraint('payee_creditor_id', 'offer_id')) op.create_table( 'created_formal_offer_signal', sa.Column('inserted_at_ts', sa.TIMESTAMP(timezone=True), nullable=False), sa.Column('payee_creditor_id', sa.BigInteger(), nullable=False), sa.Column('offer_id', sa.BigInteger(), nullable=False), sa.Column('offer_announcement_id', sa.BigInteger(), nullable=False), sa.Column('offer_secret', postgresql.BYTEA(), nullable=False), sa.Column('offer_created_at_ts', sa.TIMESTAMP(timezone=True), nullable=False), sa.PrimaryKeyConstraint('payee_creditor_id', 'offer_id')) op.create_table( 'failed_payment_signal', sa.Column('inserted_at_ts', sa.TIMESTAMP(timezone=True), nullable=False), sa.Column('payee_creditor_id', sa.BigInteger(), nullable=False), sa.Column('offer_id', sa.BigInteger(), nullable=False), sa.Column('payer_creditor_id', sa.BigInteger(), nullable=False), sa.Column('payer_payment_order_seqnum', sa.Integer(), nullable=False), sa.Column('details', postgresql.JSON(astext_type=sa.Text()), nullable=False), sa.PrimaryKeyConstraint('payee_creditor_id', 'offer_id', 'payer_creditor_id', 'payer_payment_order_seqnum')) op.create_table( 'failed_reciprocal_payment_signal', sa.Column('inserted_at_ts', sa.TIMESTAMP(timezone=True), nullable=False), sa.Column('payee_creditor_id', sa.BigInteger(), nullable=False), sa.Column('offer_id', sa.BigInteger(), nullable=False), sa.Column('details', postgresql.JSON(astext_type=sa.Text()), nullable=False), sa.PrimaryKeyConstraint('payee_creditor_id', 'offer_id')) op.create_table( 'finalize_prepared_transfer_signal', sa.Column('inserted_at_ts', sa.TIMESTAMP(timezone=True), nullable=False), sa.Column('payee_creditor_id', sa.BigInteger(), nullable=False), sa.Column('signal_id', sa.BigInteger(), autoincrement=True, nullable=False), sa.Column('debtor_id', sa.BigInteger(), nullable=False), sa.Column('sender_creditor_id', sa.BigInteger(), nullable=False), sa.Column('transfer_id', sa.BigInteger(), nullable=False), sa.Column('committed_amount', sa.BigInteger(), nullable=False), sa.Column('transfer_info', postgresql.JSON(astext_type=sa.Text()), nullable=False), sa.CheckConstraint('committed_amount >= 0'), sa.PrimaryKeyConstraint('payee_creditor_id', 'signal_id')) op.create_table( 'formal_offer', sa.Column( 'payee_creditor_id', sa.BigInteger(), nullable=False, comment= 'The payee, also the one that is responsible to supply the goods or services.' ), sa.Column('offer_id', sa.BigInteger(), autoincrement=True, nullable=False), sa.Column( 'offer_secret', postgresql.BYTEA(), nullable=False, comment= 'A random sequence of bytes that the potential payer should know in order to view the offer or make a payment.' ), sa.Column( 'debtor_ids', postgresql.ARRAY(sa.BigInteger(), dimensions=1), nullable=False, comment= 'The payment should go through one of these debtors. Each element in this array must have a corresponding element in the `debtor_amounts` array. Note thatthe database schema allows some or all of the elements to be `NULL`, which should be handled with care.' ), sa.Column( 'debtor_amounts', postgresql.ARRAY(sa.BigInteger(), dimensions=1), nullable=False, comment= 'Each element in this array must have a corresponding element in the `debtor_ids` array. Note that the database schema allows one debtor ID to occur more than once in the `debtor_ids` array, each time with a different corresponding amount. The payer is expected to transfer one of the amounts corresponding to the chosen debtor. Also note that the database schema allows some or all of the `debtor_amounts` elements to be `NULL` or negative numbers, which should be handled as if they were zeros.' ), sa.Column( 'description', postgresql.JSON(astext_type=sa.Text()), nullable=True, comment= 'A more or less detailed description of the goods or services that will be supplied if a payment is made to the offer. `NULL` means that the payee has no responsibilities whatsoever.' ), sa.Column( 'reciprocal_payment_debtor_id', sa.BigInteger(), nullable=True, comment= 'The ID of the debtor through which the reciprocal payment will go.If this is not NULL, when a payment is made to the offer, an automatic reciprocal payment will be made from the payee to the payer.' ), sa.Column( 'reciprocal_payment_amount', sa.BigInteger(), server_default=sa.text('0'), nullable=False, comment='The amount to be transferred in the reciprocal payment.'), sa.Column('valid_until_ts', sa.TIMESTAMP(timezone=True), nullable=False, comment='The offer will not be valid after this deadline.'), sa.Column('created_at_ts', sa.TIMESTAMP(timezone=True), nullable=False), sa.CheckConstraint('array_ndims(debtor_amounts) = 1'), sa.CheckConstraint('array_ndims(debtor_ids) = 1'), sa.CheckConstraint( 'cardinality(debtor_ids) = cardinality(debtor_amounts)'), sa.CheckConstraint('reciprocal_payment_amount >= 0'), sa.CheckConstraint( 'reciprocal_payment_debtor_id IS NOT NULL OR reciprocal_payment_amount = 0' ), sa.PrimaryKeyConstraint('payee_creditor_id', 'offer_id'), comment= 'Represents an offer to supply some goods or services for a stated price.' ) op.create_table( 'payment_order', sa.Column('payee_creditor_id', sa.BigInteger(), nullable=False), sa.Column('offer_id', sa.BigInteger(), nullable=False), sa.Column('payer_creditor_id', sa.BigInteger(), nullable=False, comment='The payer.'), sa.Column( 'payer_payment_order_seqnum', sa.Integer(), nullable=False, comment= 'A number generated by the payer. It is used to distinguish between several payment orders issued against one offer.' ), sa.Column( 'debtor_id', sa.BigInteger(), nullable=False, comment= 'The ID of the debtor through which the payment should go. Must be one of the values in the `formal_offer.debtor_ids` array.' ), sa.Column( 'amount', sa.BigInteger(), nullable=False, comment= 'The amount to be transferred in the payment. Must be equal to the corresponding value in the `formal_offer.debtor_amounts` array.' ), sa.Column( 'reciprocal_payment_debtor_id', sa.BigInteger(), nullable=True, comment= 'A copy of the corresponding `formal_offer.reciprocal_payment_debtor_id`.' ), sa.Column( 'reciprocal_payment_amount', sa.BigInteger(), nullable=False, comment= 'A copy of the corresponding `formal_offer.reciprocal_payment_amount`.' ), sa.Column( 'payer_note', postgresql.JSON(astext_type=sa.Text()), nullable=True, comment= 'A note from the payer. Can be anything that the payer wants the payee to see.If the payment is successful, the content of this column will be copied over to the `payment_proof.payer_note` column. After that, the value can be set to NULL.' ), sa.Column( 'proof_secret', postgresql.BYTEA(), nullable=True, comment= 'A random sequence of bytes that the interested party should know in order to view the payment proof. If the payment is successful, the content of this column will be copied over to the `payment_proof.proof_secret` column. After that, the value can be set to NULL.' ), sa.Column( 'payment_coordinator_request_id', sa.BigInteger(), server_default=sa.text( "nextval('payment_coordinator_request_id_seq')"), nullable=False, comment= 'This is the value of the `coordinator_request_id` parameter, which has been sent with the `prepare_transfer` message for the payment. The value of `payee_creditor_id` is sent as the `coordinator_id` parameter. `coordinator_type` is "payment".' ), sa.Column( 'payment_transfer_id', sa.BigInteger(), nullable=True, comment= 'This value, along with `debtor_id` and `payer_creditor_id` uniquely identifies the prepared transfer for the payment.' ), sa.Column( 'reciprocal_payment_transfer_id', sa.BigInteger(), nullable=True, comment= 'When a reciprocal payment is required, this value along with `reciprocal_payment_debtor_id` and `payee_creditor_id` uniquely identifiesthe prepared transfer for the reciprocal payment. The reciprocal payment should be initiated only after the primary payment has been prepared successfully. The value of the `coordinator_request_id` parameter for the reciprocal payment should be `-payment_coordinator_request_id` (always a negative number). `coordinator_id` should be `payee_creditor_id`. `coordinator_type` should be "payment".' ), sa.Column( 'finalized_at_ts', sa.TIMESTAMP(timezone=True), nullable=True, comment= 'The moment at which the payment order was finalized. NULL means that the payment order has not been finalized yet.' ), sa.CheckConstraint('amount >= 0'), sa.CheckConstraint( 'finalized_at_ts IS NOT NULL OR payer_note IS NOT NULL AND proof_secret IS NOT NULL' ), sa.CheckConstraint('payment_coordinator_request_id > 0'), sa.CheckConstraint('reciprocal_payment_amount >= 0'), sa.CheckConstraint( 'reciprocal_payment_debtor_id IS NOT NULL OR reciprocal_payment_amount = 0' ), sa.PrimaryKeyConstraint('payee_creditor_id', 'offer_id', 'payer_creditor_id', 'payer_payment_order_seqnum'), comment= 'Represents a recent order from a payer to make a payment to an offer. Note that finalized payment orders (failed or successful) must not be deleted right away. Instead, after they have been finalized, they should stay in the database for at least few days. This is necessary in order to prevent problems caused by message re-delivery.' ) op.create_index('idx_payment_coordinator_request_id', 'payment_order', ['payee_creditor_id', 'payment_coordinator_request_id'], unique=True) op.create_table( 'payment_proof', sa.Column('payee_creditor_id', sa.BigInteger(), nullable=False), sa.Column('proof_id', sa.BigInteger(), autoincrement=True, nullable=False), sa.Column('proof_secret', postgresql.BYTEA(), nullable=False), sa.Column('payer_creditor_id', sa.BigInteger(), nullable=False), sa.Column( 'debtor_id', sa.BigInteger(), nullable=False, comment='The ID of the debtor through which the payment went.'), sa.Column('amount', sa.BigInteger(), nullable=False), sa.Column('payer_note', postgresql.JSON(astext_type=sa.Text()), nullable=False), sa.Column('paid_at_ts', sa.TIMESTAMP(timezone=True), nullable=False), sa.Column('reciprocal_payment_debtor_id', sa.BigInteger(), nullable=True), sa.Column('reciprocal_payment_amount', sa.BigInteger(), nullable=False), sa.Column('offer_id', sa.BigInteger(), nullable=False), sa.Column('offer_created_at_ts', sa.TIMESTAMP(timezone=True), nullable=False), sa.Column('offer_description', postgresql.JSON(astext_type=sa.Text()), nullable=True), sa.CheckConstraint('amount >= 0'), sa.CheckConstraint('reciprocal_payment_amount >= 0'), sa.CheckConstraint( 'reciprocal_payment_debtor_id IS NOT NULL OR reciprocal_payment_amount = 0' ), sa.PrimaryKeyConstraint('payee_creditor_id', 'proof_id'), comment= 'Represents an evidence that a payment has been made to an offer. (The corresponding offer has been deleted.)' ) op.create_table( 'prepare_transfer_signal', sa.Column('inserted_at_ts', sa.TIMESTAMP(timezone=True), nullable=False), sa.Column('payee_creditor_id', sa.BigInteger(), nullable=False), sa.Column('coordinator_request_id', sa.BigInteger(), nullable=False), sa.Column('min_amount', sa.BigInteger(), nullable=False), sa.Column('max_amount', sa.BigInteger(), nullable=False), sa.Column('debtor_id', sa.BigInteger(), nullable=False), sa.Column('sender_creditor_id', sa.BigInteger(), nullable=False), sa.Column('recipient_creditor_id', sa.BigInteger(), nullable=False), sa.CheckConstraint('max_amount >= min_amount'), sa.CheckConstraint('min_amount > 0'), sa.PrimaryKeyConstraint('payee_creditor_id', 'coordinator_request_id')) op.create_table( 'successful_payment_signal', sa.Column('inserted_at_ts', sa.TIMESTAMP(timezone=True), nullable=False), sa.Column('payee_creditor_id', sa.BigInteger(), nullable=False), sa.Column('offer_id', sa.BigInteger(), nullable=False), sa.Column('payer_creditor_id', sa.BigInteger(), nullable=False), sa.Column('payer_payment_order_seqnum', sa.Integer(), nullable=False), sa.Column('debtor_id', sa.BigInteger(), nullable=False), sa.Column('amount', sa.BigInteger(), nullable=False), sa.Column('payer_note', postgresql.JSON(astext_type=sa.Text()), nullable=False), sa.Column('paid_at_ts', sa.TIMESTAMP(timezone=True), nullable=False), sa.Column('reciprocal_payment_debtor_id', sa.BigInteger(), nullable=True), sa.Column('reciprocal_payment_amount', sa.BigInteger(), nullable=False), sa.Column('proof_id', sa.BigInteger(), nullable=False), sa.CheckConstraint('amount >= 0'), sa.CheckConstraint('reciprocal_payment_amount >= 0'), sa.CheckConstraint( 'reciprocal_payment_debtor_id IS NOT NULL OR reciprocal_payment_amount = 0' ), sa.PrimaryKeyConstraint('payee_creditor_id', 'offer_id', 'payer_creditor_id', 'payer_payment_order_seqnum'))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "users", sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("email", sa.TEXT(), nullable=False), sa.Column("created_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("updated_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("deleted_at", postgresql.TIMESTAMP(), nullable=True), sa.PrimaryKeyConstraint("id", name=op.f("pk_users")), sa.UniqueConstraint("email", name=op.f("uq_users_email")), ) op.create_table( "credentials", sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("username", sa.TEXT(), nullable=False), sa.Column("password", postgresql.BYTEA(), nullable=False), sa.Column("last_seen", postgresql.TIMESTAMP(), nullable=True), sa.Column("user_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("created_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("updated_at", postgresql.TIMESTAMP(), nullable=True), sa.ForeignKeyConstraint(["user_id"], ["users.id"], name=op.f("fk_credentials_user_id_users")), sa.PrimaryKeyConstraint("id", name=op.f("pk_credentials")), sa.UniqueConstraint("username", name=op.f("uq_credentials_username")), ) op.create_table( "event_statuses", sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("name", sa.TEXT(), nullable=False), sa.Column("user_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("created_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("updated_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("deleted_at", postgresql.TIMESTAMP(), nullable=True), sa.ForeignKeyConstraint(["user_id"], ["users.id"], name=op.f("fk_event_statuses_user_id_users")), sa.PrimaryKeyConstraint("id", name=op.f("pk_event_statuses")), ) op.create_table( "event_types", sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("name", sa.TEXT(), nullable=False), sa.Column("user_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("created_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("updated_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("deleted_at", postgresql.TIMESTAMP(), nullable=True), sa.ForeignKeyConstraint(["user_id"], ["users.id"], name=op.f("fk_event_types_user_id_users")), sa.PrimaryKeyConstraint("id", name=op.f("pk_event_types")), ) op.create_table( "hive_conditions", sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("name", sa.TEXT(), nullable=False), sa.Column("user_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("created_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("updated_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("deleted_at", postgresql.TIMESTAMP(), nullable=True), sa.ForeignKeyConstraint(["user_id"], ["users.id"], name=op.f("fk_hive_conditions_user_id_users")), sa.PrimaryKeyConstraint("id", name=op.f("pk_hive_conditions")), ) op.create_table( "honey_types", sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("name", sa.TEXT(), nullable=True), sa.Column("user_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("created_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("updated_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("deleted_at", postgresql.TIMESTAMP(), nullable=True), sa.ForeignKeyConstraint(["user_id"], ["users.id"], name=op.f("fk_honey_types_user_id_users")), sa.PrimaryKeyConstraint("id", name=op.f("pk_honey_types")), ) op.create_table( "owners", sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("name", sa.TEXT(), nullable=False), sa.Column("user_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("created_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("updated_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("deleted_at", postgresql.TIMESTAMP(), nullable=True), sa.ForeignKeyConstraint(["user_id"], ["users.id"], name=op.f("fk_owners_user_id_users")), sa.PrimaryKeyConstraint("id", name=op.f("pk_owners")), ) op.create_table( "swarm_health_statuses", sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("name", sa.TEXT(), nullable=True), sa.Column("user_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("created_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("updated_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("deleted_at", postgresql.TIMESTAMP(), nullable=True), sa.ForeignKeyConstraint( ["user_id"], ["users.id"], name=op.f("fk_swarm_health_statuses_user_id_users"), ), sa.PrimaryKeyConstraint("id", name=op.f("pk_swarm_health_statuses")), ) op.create_table( "apiaries", sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("name", sa.TEXT(), nullable=False), sa.Column("location", sa.TEXT(), nullable=False), sa.Column("user_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("honey_type_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("created_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("updated_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("deleted_at", postgresql.TIMESTAMP(), nullable=True), sa.ForeignKeyConstraint( ["honey_type_id"], ["honey_types.id"], name=op.f("fk_apiaries_honey_type_id_honey_types"), ), sa.ForeignKeyConstraint(["user_id"], ["users.id"], name=op.f("fk_apiaries_user_id_users")), sa.PrimaryKeyConstraint("id", name=op.f("pk_apiaries")), ) op.create_table( "swarms", sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("health_status_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("user_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("created_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("updated_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("deleted_at", postgresql.TIMESTAMP(), nullable=True), sa.ForeignKeyConstraint( ["health_status_id"], ["swarm_health_statuses.id"], name=op.f("fk_swarms_health_status_id_swarm_health_statuses"), ), sa.ForeignKeyConstraint(["user_id"], ["users.id"], name=op.f("fk_swarms_user_id_users")), sa.PrimaryKeyConstraint("id", name=op.f("pk_swarms")), ) op.create_table( "hives", sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("name", sa.TEXT(), nullable=False), sa.Column("user_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("condition_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("owner_id", postgresql.UUID(as_uuid=True), nullable=True), sa.Column("swarm_id", postgresql.UUID(as_uuid=True), nullable=True), sa.Column("apiary_id", postgresql.UUID(as_uuid=True), nullable=True), sa.Column("created_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("updated_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("deleted_at", postgresql.TIMESTAMP(), nullable=True), sa.ForeignKeyConstraint(["apiary_id"], ["apiaries.id"], name=op.f("fk_hives_apiary_id_apiaries")), sa.ForeignKeyConstraint( ["condition_id"], ["hive_conditions.id"], name=op.f("fk_hives_condition_id_hive_conditions"), ), sa.ForeignKeyConstraint(["owner_id"], ["owners.id"], name=op.f("fk_hives_owner_id_owners")), sa.ForeignKeyConstraint(["swarm_id"], ["swarms.id"], name=op.f("fk_hives_swarm_id_swarms")), sa.ForeignKeyConstraint(["user_id"], ["users.id"], name=op.f("fk_hives_user_id_users")), sa.PrimaryKeyConstraint("id", name=op.f("pk_hives")), ) op.create_table( "events", sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("title", sa.TEXT(), nullable=False), sa.Column("description", sa.TEXT(), nullable=True), sa.Column("due_date", postgresql.TIMESTAMP(), nullable=False), sa.Column("user_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("type_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("status_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("hive_id", postgresql.UUID(as_uuid=True), nullable=True), sa.Column("created_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("updated_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("deleted_at", postgresql.TIMESTAMP(), nullable=True), sa.ForeignKeyConstraint(["hive_id"], ["hives.id"], name=op.f("fk_events_hive_id_hives")), sa.ForeignKeyConstraint( ["status_id"], ["event_statuses.id"], name=op.f("fk_events_status_id_event_statuses"), ), sa.ForeignKeyConstraint(["type_id"], ["event_types.id"], name=op.f("fk_events_type_id_event_types")), sa.ForeignKeyConstraint(["user_id"], ["users.id"], name=op.f("fk_events_user_id_users")), sa.PrimaryKeyConstraint("id", name=op.f("pk_events")), ) op.create_table( "comments", sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("comment", sa.TEXT(), nullable=False), sa.Column("type", sa.TEXT(), nullable=False), sa.Column("date", postgresql.TIMESTAMP(), nullable=False), sa.Column("user_id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("swarm_id", postgresql.UUID(as_uuid=True), nullable=True), sa.Column("hive_id", postgresql.UUID(as_uuid=True), nullable=True), sa.Column("event_id", postgresql.UUID(as_uuid=True), nullable=True), sa.Column("created_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("updated_at", postgresql.TIMESTAMP(), nullable=True), sa.Column("deleted_at", postgresql.TIMESTAMP(), nullable=True), sa.ForeignKeyConstraint(["event_id"], ["events.id"], name=op.f("fk_comments_event_id_events")), sa.ForeignKeyConstraint(["hive_id"], ["hives.id"], name=op.f("fk_comments_hive_id_hives")), sa.ForeignKeyConstraint(["swarm_id"], ["swarms.id"], name=op.f("fk_comments_swarm_id_swarms")), sa.ForeignKeyConstraint(["user_id"], ["users.id"], name=op.f("fk_comments_user_id_users")), sa.PrimaryKeyConstraint("id", name=op.f("pk_comments")), )
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('courses', 'fitness_total') op.create_table( 'celery_taskmeta', sa.Column('id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('task_id', sa.VARCHAR(length=155), autoincrement=False, nullable=True), sa.Column('status', sa.VARCHAR(length=50), autoincrement=False, nullable=True), sa.Column('result', postgresql.BYTEA(), autoincrement=False, nullable=True), sa.Column('date_done', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('traceback', sa.TEXT(), autoincrement=False, nullable=True), sa.Column('name', sa.VARCHAR(length=155), autoincrement=False, nullable=True), sa.Column('args', postgresql.BYTEA(), autoincrement=False, nullable=True), sa.Column('kwargs', postgresql.BYTEA(), autoincrement=False, nullable=True), sa.Column('worker', sa.VARCHAR(length=155), autoincrement=False, nullable=True), sa.Column('retries', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('queue', sa.VARCHAR(length=155), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='celery_taskmeta_pkey'), sa.UniqueConstraint('task_id', name='celery_taskmeta_task_id_key')) op.create_table( 'celery_tasksetmeta', sa.Column('id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('taskset_id', sa.VARCHAR(length=155), autoincrement=False, nullable=True), sa.Column('result', postgresql.BYTEA(), autoincrement=False, nullable=True), sa.Column('date_done', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='celery_tasksetmeta_pkey'), sa.UniqueConstraint('taskset_id', name='celery_tasksetmeta_taskset_id_key'))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'feedback', sa.Column('feedback_id', sa.Integer(), nullable=False), sa.Column('user_ID', sa.String(length=80), nullable=True), sa.Column('prediction', sa.Integer(), nullable=True), sa.Column('rating', postgresql.JSON(astext_type=sa.Text()), nullable=True), sa.Column('feedback', postgresql.JSON(astext_type=sa.Text()), nullable=True), sa.PrimaryKeyConstraint('feedback_id')) op.create_table( 'prediction', sa.Column('prediction_id', sa.Integer(), nullable=False), sa.Column('analysis_model_name', sa.String(length=40), nullable=True), sa.Column('score', sa.Float(), nullable=True), sa.Column('model_id', sa.Integer(), nullable=True), sa.PrimaryKeyConstraint('prediction_id')) op.create_table( 'prepared_data', sa.Column('prepared_id', sa.String(length=80), nullable=False), sa.Column('project_ID', sa.Integer(), nullable=True), sa.Column('preprared_data', postgresql.JSON(astext_type=sa.Text()), nullable=True), sa.Column('sample_ID', sa.Integer(), nullable=True), sa.PrimaryKeyConstraint('prepared_id')) op.create_table( 'project', sa.Column('project_id', sa.String(length=80), nullable=False), sa.Column('raw_data_id', sa.Integer(), nullable=True), sa.Column('algo', sa.String(length=40), nullable=True), sa.Column('user_id', sa.String(length=80), nullable=True), sa.PrimaryKeyConstraint('project_id')) op.create_table( 'raw_data', sa.Column('id', sa.Integer(), nullable=False), sa.Column('user_id', sa.String(length=80), nullable=True), sa.Column('raw_data_set', postgresql.JSON(astext_type=sa.Text()), nullable=True), sa.PrimaryKeyConstraint('id')) op.create_table( 'reviwer', sa.Column('project_id', sa.String(length=80), nullable=False), sa.PrimaryKeyConstraint('project_id')) op.create_table( 'sample_data', sa.Column('sample_ID', sa.Integer(), nullable=False), sa.Column('sample_Data', postgresql.JSON(astext_type=sa.Text()), nullable=True), sa.Column('trained_model', postgresql.BYTEA(), nullable=True), sa.PrimaryKeyConstraint('sample_ID')) op.create_table( 'trained_model_result', sa.Column('model_id', sa.Integer(), nullable=False), sa.Column('model', postgresql.BYTEA(), nullable=True), sa.Column('project_id', sa.Integer(), nullable=True), sa.Column('parameter', postgresql.JSON(astext_type=sa.Text()), nullable=True), sa.PrimaryKeyConstraint('model_id')) op.create_table( 'user', sa.Column('user_id', sa.String(length=80), nullable=False), sa.Column('prediction', postgresql.JSON(astext_type=sa.Text()), nullable=True), sa.Column('project_id', sa.String(length=80), nullable=True), sa.PrimaryKeyConstraint('user_id'))
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('users', sa.Column('pro_pic', postgresql.BYTEA(), autoincrement=False, nullable=True)) op.create_unique_constraint('users_pro_pic_key', 'users', ['pro_pic'])
def downgrade(): conn = op.get_bind() # --- Proposal --------------------------------------------------------------------- op.add_column( 'proposal', sa.Column('email', sa.VARCHAR(length=80), autoincrement=False, nullable=True), ) count = conn.scalar( sa.select([sa.func.count('*')]) .select_from(proposal) .where(proposal.c.email_address_id.isnot(None)) ) progress = get_progressbar("Proposals", count) progress.start() items = conn.execute( sa.select([proposal.c.id, email_address.c.email]).where( proposal.c.email_address_id == email_address.c.id ) ) for counter, item in enumerate(items): conn.execute( proposal.update().where(proposal.c.id == item.id).values(email=item.email) ) progress.update(counter) progress.finish() op.drop_constraint('proposal_email_address_id_fkey', 'proposal', type_='foreignkey') op.drop_index(op.f('ix_proposal_email_address_id'), table_name='proposal') op.drop_column('proposal', 'email_address_id') # --- UserEmailClaim --------------------------------------------------------------- op.add_column( 'user_email_claim', sa.Column('md5sum', sa.VARCHAR(length=32), autoincrement=False, nullable=True), ) op.add_column( 'user_email_claim', sa.Column('domain', sa.VARCHAR(length=253), autoincrement=False, nullable=True), ) op.add_column( 'user_email_claim', sa.Column('email', sa.VARCHAR(length=254), autoincrement=False, nullable=True), ) count = conn.scalar(sa.select([sa.func.count('*')]).select_from(user_email_claim)) progress = get_progressbar("Email claims", count) progress.start() items = conn.execute( sa.select([user_email_claim.c.id, email_address.c.email]).where( user_email_claim.c.email_address_id == email_address.c.id ) ) for counter, item in enumerate(items): conn.execute( user_email_claim.update() .where(user_email_claim.c.id == item.id) .values( email=item.email, md5sum=email_md5sum(item.email), domain=email_domain(item.email), ) ) progress.update(counter) progress.finish() op.alter_column('user_email_claim', 'md5sum', nullable=False) op.alter_column('user_email_claim', 'domain', nullable=False) # Due to a longstanding oversight, UserEmailClaim.email was nullable. We do not # attempt to correct it in this migration op.drop_constraint( 'user_email_claim_email_address_id_fkey', 'user_email_claim', type_='foreignkey' ) op.drop_constraint( 'user_email_claim_user_id_email_address_id_key', 'user_email_claim', type_='unique', ) op.create_unique_constraint( 'user_email_claim_user_id_email_key', 'user_email_claim', ['user_id', 'email'] ) op.create_index( 'ix_user_email_claim_md5sum', 'user_email_claim', ['md5sum'], unique=False ) op.create_index( 'ix_user_email_claim_email', 'user_email_claim', ['email'], unique=False ) op.create_index( 'ix_user_email_claim_domain', 'user_email_claim', ['domain'], unique=False ) op.drop_index( op.f('ix_user_email_claim_email_address_id'), table_name='user_email_claim' ) op.drop_column('user_email_claim', 'email_address_id') # --- UserEmail -------------------------------------------------------------------- op.add_column( 'user_email', sa.Column('md5sum', sa.VARCHAR(length=32), autoincrement=False, nullable=True), ) op.add_column( 'user_email', sa.Column('domain', sa.VARCHAR(length=253), autoincrement=False, nullable=True), ) op.add_column( 'user_email', sa.Column('email', sa.VARCHAR(length=254), autoincrement=False, nullable=True), ) op.add_column( 'user_email', sa.Column('blake2b', postgresql.BYTEA(), autoincrement=False, nullable=True), ) count = conn.scalar(sa.select([sa.func.count('*')]).select_from(user_email)) progress = get_progressbar("Emails", count) progress.start() items = conn.execute( sa.select([user_email.c.id, email_address.c.email]).where( user_email.c.email_address_id == email_address.c.id ) ) for counter, item in enumerate(items): conn.execute( user_email.update() .where(user_email.c.id == item.id) .values( email=item.email, md5sum=email_md5sum(item.email), domain=email_domain(item.email), blake2b=email_blake2b128_hash(item.email), ) ) progress.update(counter) progress.finish() op.alter_column('user_email', 'md5sum', nullable=False) op.alter_column('user_email', 'domain', nullable=False) op.alter_column('user_email', 'email', nullable=False) op.alter_column('user_email', 'blake2b', nullable=False) op.drop_constraint( 'user_email_email_address_id_fkey', 'user_email', type_='foreignkey' ) op.drop_constraint('user_email_email_address_id_key', 'user_email', type_='unique') op.create_unique_constraint('user_email_md5sum_key', 'user_email', ['md5sum']) op.create_unique_constraint('user_email_email_key', 'user_email', ['email']) op.create_unique_constraint('user_email_blake2b_key', 'user_email', ['blake2b']) op.create_index('ix_user_email_domain', 'user_email', ['domain'], unique=False) op.drop_column('user_email', 'email_address_id') # --- Drop imported contents and restart sequence ---------------------------------- op.execute(email_address.delete()) op.execute(sa.text('ALTER SEQUENCE email_address_id_seq RESTART'))
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('skin', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('title', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('fname', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('orders', sa.INTEGER(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='skin_pkey') ) op.create_table('users', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('name', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('email', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('passwd', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('title', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('disabled', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=True), sa.Column('super', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='users_pkey') ) op.create_table('docscomment', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('link', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('users_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('datetimeon', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('content', sa.TEXT(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='docscomment_pkey') ) op.create_table('node', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('name', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('title', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('keywords', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('type', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('content', sa.TEXT(), autoincrement=False, nullable=True), sa.Column('summary', sa.TEXT(), autoincrement=False, nullable=True), sa.Column('orders', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=False), sa.Column('parentid', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('link', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('hidden', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=True), sa.Column('target', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('custom', postgresql.BYTEA(), autoincrement=False, nullable=True), sa.Column('skin_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('uri', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('users_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('groups_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('mods', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('folderid', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('folder', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=True), sa.Column('modules_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('image', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='node_pkey') ) op.create_table('wikicomment', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('link', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('users_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('datetimeon', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('content', sa.TEXT(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='wikicomment_pkey') ) op.create_table('news', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('title', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('description', sa.TEXT(), autoincrement=False, nullable=True), sa.Column('datetimeon', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('submit_users_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='news_pkey') ) op.create_table('modules', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('name', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('title', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('orders', sa.INTEGER(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='modules_pkey') ) op.create_table('project', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('users_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('node_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('title', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('summary', sa.TEXT(), autoincrement=False, nullable=True), sa.Column('description', sa.TEXT(), autoincrement=False, nullable=True), sa.Column('uri', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('datetimeon', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('image', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='project_pkey') ) op.create_table('projectcomment', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('project_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('users_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('datetimeon', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('content', sa.TEXT(), autoincrement=False, nullable=True), sa.Column('rating', sa.INTEGER(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='projectcomment_pkey') ) op.create_table('groups', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('name', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('title', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('orders', sa.INTEGER(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='groups_pkey') ) op.create_table('tags', sa.Column('project_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('value', sa.VARCHAR(length=32), autoincrement=False, nullable=True) ) op.create_table('wiki', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('link', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('summary', sa.TEXT(), autoincrement=False, nullable=True), sa.Column('content', sa.TEXT(), autoincrement=False, nullable=True), sa.Column('datetimeon', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('fname', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('changes', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('users_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('latest', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('name', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('title', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('parent', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('keywords', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='wiki_pkey') ) op.create_table('users_groups', sa.Column('users_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('groups_id', sa.INTEGER(), autoincrement=False, nullable=True) ) op.create_table('release', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('project_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('datetimeon', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('description', sa.TEXT(), autoincrement=False, nullable=True), sa.Column('srcuri', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('winuri', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('macuri', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('title', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='release_pkey') )
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('Task', sa.Column('id', sa.INTEGER(), server_default=sa.text('nextval(\'pl_inbox."Task_id_seq"\'::regclass)'), nullable=False), sa.Column('uniqueId', sa.VARCHAR(length=100), autoincrement=False, nullable=False), sa.Column('userId', sa.VARCHAR(length=50), autoincrement=False, nullable=False), sa.Column('dateTime', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), sa.Column('title', sa.VARCHAR(length=100), autoincrement=False, nullable=False), sa.Column('description', sa.VARCHAR(length=2000), autoincrement=False, nullable=True), sa.Column('iconPath', sa.VARCHAR(length=200), autoincrement=False, nullable=True), sa.Column('routePath', sa.VARCHAR(length=200), autoincrement=False, nullable=True), sa.Column('routeParamJson', sa.VARCHAR(length=200), autoincrement=False, nullable=True), sa.Column('onDeliveredPayload', postgresql.BYTEA(), autoincrement=False, nullable=True), sa.Column('onCompletedPayload', postgresql.BYTEA(), autoincrement=False, nullable=True), sa.Column('onDeletedPayload', postgresql.BYTEA(), autoincrement=False, nullable=True), sa.Column('autoComplete', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=False), sa.Column('autoDelete', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=False), sa.Column('stateFlags', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=False), sa.Column('notificationRequiredFlags', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=False), sa.Column('notificationSentFlags', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=False), sa.Column('displayAs', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=False), sa.Column('autoDeleteDateTime', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('displayPriority', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=False), sa.Column('onDialogConfirmPayload', postgresql.BYTEA(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='Task_pkey'), sa.UniqueConstraint('uniqueId', name='Task_uniqueId_key'), schema='pl_inbox', postgresql_ignore_search_path=False ) op.create_table('Setting', sa.Column('id', sa.INTEGER(), server_default=sa.text('nextval(\'pl_inbox."Setting_id_seq"\'::regclass)'), nullable=False), sa.Column('name', sa.VARCHAR(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='Setting_pkey'), schema='pl_inbox', postgresql_ignore_search_path=False ) op.create_table('Activity', sa.Column('id', sa.INTEGER(), server_default=sa.text('nextval(\'pl_inbox."Activity_id_seq"\'::regclass)'), nullable=False), sa.Column('uniqueId', sa.VARCHAR(length=100), autoincrement=False, nullable=False), sa.Column('userId', sa.VARCHAR(length=50), autoincrement=False, nullable=False), sa.Column('dateTime', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), sa.Column('title', sa.VARCHAR(length=100), autoincrement=False, nullable=False), sa.Column('description', sa.VARCHAR(length=2000), autoincrement=False, nullable=True), sa.Column('iconPath', sa.VARCHAR(length=200), autoincrement=False, nullable=True), sa.Column('routePath', sa.VARCHAR(length=200), autoincrement=False, nullable=True), sa.Column('routeParamJson', sa.VARCHAR(length=200), autoincrement=False, nullable=True), sa.Column('autoDeleteDateTime', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), sa.PrimaryKeyConstraint('id', name='Activity_pkey'), sa.UniqueConstraint('uniqueId', name='Activity_uniqueId_key'), schema='pl_inbox' ) op.create_table('TaskAction', sa.Column('id', sa.INTEGER(), server_default=sa.text('nextval(\'pl_inbox."TaskAction_id_seq"\'::regclass)'), nullable=False), sa.Column('taskId', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('title', sa.VARCHAR(length=50), autoincrement=False, nullable=True), sa.Column('confirmMessage', sa.VARCHAR(length=200), autoincrement=False, nullable=True), sa.Column('onActionPayload', postgresql.BYTEA(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['taskId'], ['pl_inbox.Task.id'], name='TaskAction_taskId_fkey', ondelete='CASCADE'), sa.PrimaryKeyConstraint('id', name='TaskAction_pkey'), schema='pl_inbox' ) op.create_table('SettingProperty', sa.Column('id', sa.INTEGER(), server_default=sa.text('nextval(\'pl_inbox."SettingProperty_id_seq"\'::regclass)'), nullable=False), sa.Column('settingId', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('key', sa.VARCHAR(length=50), autoincrement=False, nullable=False), sa.Column('type', sa.VARCHAR(length=16), autoincrement=False, nullable=True), sa.Column('int_value', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('char_value', sa.VARCHAR(), autoincrement=False, nullable=True), sa.Column('boolean_value', sa.BOOLEAN(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['settingId'], ['pl_inbox.Setting.id'], name='SettingProperty_settingId_fkey'), sa.PrimaryKeyConstraint('id', name='SettingProperty_pkey'), schema='pl_inbox' )
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( "set", sa.Column("bonuses", postgresql.BYTEA(), autoincrement=False, nullable=True), ) op.drop_index(op.f("ix_item_stat_item_id"), table_name="item_stat") op.alter_column( "item_stat", "item_id", existing_type=postgresql.UUID(), nullable=True ) op.add_column( "item_condition", sa.Column("condition_type", sa.VARCHAR(), autoincrement=False, nullable=True), ) op.add_column( "item_condition", sa.Column("stat_type", sa.VARCHAR(), autoincrement=False, nullable=True), ) op.drop_index(op.f("ix_item_condition_item_id"), table_name="item_condition") op.drop_column("item_condition", "stat_greater_than") op.drop_column("item_condition", "stat") op.drop_column("item_condition", "is_set_bonus") op.drop_column("item_condition", "custom_condition") op.drop_index(op.f("ix_item_set_id"), table_name="item") op.drop_index(op.f("ix_item_item_type_id"), table_name="item") op.alter_column( "item", "item_type_id", existing_type=postgresql.UUID(), nullable=True ) op.alter_column("item", "image_url", existing_type=sa.VARCHAR(), nullable=True) op.drop_index( op.f("ix_custom_set_stat_custom_set_id"), table_name="custom_set_stat" ) op.alter_column( "custom_set_stat", "custom_set_id", existing_type=postgresql.UUID(), nullable=True, ) op.drop_index(op.f("ix_custom_set_owner_id"), table_name="custom_set") op.create_table( "custom_set_exo", sa.Column( "uuid", postgresql.UUID(), server_default=sa.text("uuid_generate_v4()"), autoincrement=False, nullable=False, ), sa.Column( "stat", postgresql.ENUM( "VITALITY", "AP", "MP", "INITIATIVE", "PROSPECTING", "RANGE", "SUMMON", "WISDOM", "STRENGTH", "INTELLIGENCE", "CHANCE", "AGILITY", "AP_PARRY", "AP_REDUCTION", "MP_PARRY", "MP_REDUCTION", "CRITICAL", "HEALS", "LOCK", "DODGE", "PCT_FINAL_DAMAGE", "POWER", "DAMAGE", "CRITICAL_DAMAGE", "NEUTRAL_DAMAGE", "EARTH_DAMAGE", "FIRE_DAMAGE", "WATER_DAMAGE", "AIR_DAMAGE", "REFLECT", "TRAP_DAMAGE", "TRAP_POWER", "PUSHBACK_DAMAGE", "PCT_SPELL_DAMAGE", "PCT_WEAPON_DAMAGE", "PCT_RANGED_DAMAGE", "PCT_MELEE_DAMAGE", "NEUTRAL_RES", "PCT_NEUTRAL_RES", "EARTH_RES", "PCT_EARTH_RES", "FIRE_RES", "PCT_FIRE_RES", "WATER_RES", "PCT_WATER_RES", "AIR_RES", "PCT_AIR_RES", "CRITICAL_RES", "PUSHBACK_RES", "PCT_RANGED_RES", "PCT_MELEE_RES", "PODS", name="stat", create_type=False, ), autoincrement=False, nullable=True, ), sa.Column("value", sa.INTEGER(), autoincrement=False, nullable=True), sa.Column( "custom_set_id", postgresql.UUID(), autoincrement=False, nullable=True ), sa.ForeignKeyConstraint( ["custom_set_id"], ["custom_set.uuid"], name="custom_set_exo_custom_set_id_fkey", ), sa.PrimaryKeyConstraint("uuid", name="custom_set_exo_pkey"), ) op.create_table( "custom_set_item", sa.Column( "item_slot_id", postgresql.UUID(), autoincrement=False, nullable=False ), sa.Column( "custom_set_id", postgresql.UUID(), autoincrement=False, nullable=False ), sa.Column("item_id", postgresql.UUID(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint( ["custom_set_id"], ["custom_set.uuid"], name="custom_set_fk_item_custom_set_id_custom_set", ), sa.ForeignKeyConstraint( ["item_id"], ["item.uuid"], name="custom_set_item_item_id_fkey" ), sa.ForeignKeyConstraint( ["item_slot_id"], ["item_slot.uuid"], name="custom_set_item_item_slot_id_fkey", ), sa.UniqueConstraint( "item_slot_id", "custom_set_id", name="custom_set_item_slot" ), ) op.create_index( "ix_custom_set_item_custom_set_id", "custom_set_item", ["custom_set_id"], unique=False, ) op.drop_index( op.f("ix_equipped_item_exo_num_items"), table_name="equipped_item_exo" ) op.drop_index( op.f("ix_equipped_item_exo_equipped_item_id"), table_name="equipped_item_exo" ) op.drop_table("equipped_item_exo") op.drop_index(op.f("ix_equipped_item_custom_set_id"), table_name="equipped_item") op.drop_table("equipped_item") op.drop_index(op.f("ix_set_bonus_set_id"), table_name="set_bonus") op.drop_table("set_bonus")
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('releases', sa.Column('metrics', postgresql.BYTEA(), autoincrement=False, nullable=True))
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'team', sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('team_id_seq'::regclass)"), autoincrement=True, nullable=False), sa.Column('full_team_name', sa.VARCHAR(length=100), autoincrement=False, nullable=False), sa.Column('team_name_slug', sa.VARCHAR(length=100), autoincrement=False, nullable=False), sa.Column('url_name_slug', sa.VARCHAR(length=100), autoincrement=False, nullable=True), sa.Column('base', sa.VARCHAR(length=100), autoincrement=False, nullable=True), sa.Column('team_chief', sa.VARCHAR(length=100), autoincrement=False, nullable=True), sa.Column('technical_chief', sa.VARCHAR(length=100), autoincrement=False, nullable=True), sa.Column('power_unit', sa.VARCHAR(length=50), autoincrement=False, nullable=True), sa.Column('first_team_entry', sa.VARCHAR(length=25), autoincrement=False, nullable=True), sa.Column('highest_race_finish', sa.VARCHAR(length=25), autoincrement=False, nullable=True), sa.Column('pole_positions', sa.VARCHAR(length=25), autoincrement=False, nullable=True), sa.Column('fastest_laps', sa.VARCHAR(length=25), autoincrement=False, nullable=True), sa.Column('main_image', sa.VARCHAR(length=200), autoincrement=False, nullable=True), sa.Column('flag_img_url', sa.VARCHAR(length=200), autoincrement=False, nullable=True), sa.Column('logo_url', sa.VARCHAR(length=200), autoincrement=False, nullable=True), sa.Column('podium_finishes', sa.VARCHAR(length=25), autoincrement=False, nullable=True), sa.Column('championship_titles', sa.VARCHAR(length=25), autoincrement=False, nullable=True), sa.Column('drivers_scraped', postgresql.BYTEA(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='team_pkey'), sa.UniqueConstraint('full_team_name', name='team_full_team_name_key'), sa.UniqueConstraint('team_name_slug', name='team_team_name_slug_key'), postgresql_ignore_search_path=False) op.create_table( 'driver', sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), sa.Column('driver_name', sa.VARCHAR(length=80), autoincrement=False, nullable=False), sa.Column('country', sa.VARCHAR(length=100), autoincrement=False, nullable=True), sa.Column('name_slug', sa.VARCHAR(length=80), autoincrement=False, nullable=False), sa.Column('date_of_birth', sa.VARCHAR(length=20), autoincrement=False, nullable=True), sa.Column('driver_number', sa.VARCHAR(length=10), autoincrement=False, nullable=True), sa.Column('place_of_birth', sa.VARCHAR(length=50), autoincrement=False, nullable=True), sa.Column('flag_img_url', sa.VARCHAR(length=150), autoincrement=False, nullable=True), sa.Column('main_image', sa.VARCHAR(length=150), autoincrement=False, nullable=True), sa.Column('podiums', sa.VARCHAR(length=10), autoincrement=False, nullable=True), sa.Column('world_championships', sa.VARCHAR(length=10), autoincrement=False, nullable=True), sa.Column('highest_grid_position', sa.VARCHAR(length=10), autoincrement=False, nullable=True), sa.Column('points', sa.VARCHAR(length=10), autoincrement=False, nullable=True), sa.Column('position', sa.VARCHAR(length=10), autoincrement=False, nullable=True), sa.Column('team', sa.VARCHAR(length=50), autoincrement=False, nullable=False), sa.Column('team_name_slug', sa.VARCHAR(length=50), autoincrement=False, nullable=False), sa.Column('team_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['team_id'], ['team.id'], name='driver_team_id_fkey', ondelete='CASCADE'), sa.PrimaryKeyConstraint('id', name='driver_pkey'), sa.UniqueConstraint('name_slug', name='driver_name_slug_key')) op.create_table( 'user', sa.Column('id', sa.BIGINT(), autoincrement=True, nullable=False), sa.Column('username', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('password', postgresql.BYTEA(), autoincrement=False, nullable=False), sa.Column('driver_data', postgresql.BYTEA(), autoincrement=False, nullable=True), sa.Column('team_data', postgresql.BYTEA(), autoincrement=False, nullable=True), sa.Column('is_authenticated', sa.BOOLEAN(), autoincrement=False, nullable=True), sa.Column('is_active', sa.BOOLEAN(), autoincrement=False, nullable=True), sa.Column('is_anonymous', sa.BOOLEAN(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='user_pkey'), sa.UniqueConstraint('username', name='user_username_key'))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'User', sa.Column( 'id', sa.INTEGER(), server_default=sa.text('nextval(\'"User_id_seq"\'::regclass)'), autoincrement=True, nullable=False), sa.Column('email', sa.VARCHAR(length=100), autoincrement=False, nullable=True), sa.Column('password', sa.VARCHAR(length=100), autoincrement=False, nullable=True), sa.Column('name', sa.VARCHAR(length=1000), autoincrement=False, nullable=True), sa.Column('userType', sa.VARCHAR(length=100), autoincrement=False, nullable=True), sa.Column('hasAccess', sa.BOOLEAN(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='User_pkey'), sa.UniqueConstraint('email', name='User_email_key'), postgresql_ignore_search_path=False) op.create_table( 'StudentCourses', sa.Column('courseId', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('studentId', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('grade', sa.INTEGER(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['courseId'], ['Course.id'], name='StudentCourses_courseId_fkey', ondelete='CASCADE'), sa.ForeignKeyConstraint(['studentId'], ['Student.id'], name='StudentCourses_studentId_fkey', ondelete='SET NULL'), sa.PrimaryKeyConstraint('courseId', 'studentId', name='StudentCourses_pkey')) op.create_table('Assignment', sa.Column( 'id', sa.INTEGER(), server_default=sa.text( 'nextval(\'"Assignment_id_seq"\'::regclass)'), autoincrement=True, nullable=False), sa.Column('name', sa.VARCHAR(length=1000), autoincrement=False, nullable=True), sa.Column('courseId', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('description', sa.VARCHAR(length=1000), autoincrement=False, nullable=True), sa.Column('moduleId', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('dueDate', sa.VARCHAR(length=1000), autoincrement=False, nullable=True), sa.Column('fileLoc', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('points', sa.INTEGER(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['courseId'], ['Course.id'], name='Assignment_courseId_fkey'), sa.ForeignKeyConstraint(['moduleId'], ['Module.id'], name='Assignment_moduleId_fkey'), sa.PrimaryKeyConstraint('id', name='Assignment_pkey'), postgresql_ignore_search_path=False) op.create_table('Admin', sa.Column('id', sa.INTEGER(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['id'], ['User.id'], name='Admin_id_fkey'), sa.PrimaryKeyConstraint('id', name='Admin_pkey'), postgresql_ignore_search_path=False) op.create_table( 'AssignmentGrades', sa.Column('assignmentId', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('studentId', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('fileLoc', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('grade', sa.INTEGER(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['assignmentId'], ['Assignment.id'], name='AssignmentGrades_assignmentId_fkey', ondelete='CASCADE'), sa.ForeignKeyConstraint(['studentId'], ['Student.id'], name='AssignmentGrades_studentId_fkey', ondelete='SET NULL'), sa.PrimaryKeyConstraint('assignmentId', 'studentId', name='AssignmentGrades_pkey')) op.create_table( 'Course', sa.Column( 'id', sa.INTEGER(), server_default=sa.text('nextval(\'"Course_id_seq"\'::regclass)'), autoincrement=True, nullable=False), sa.Column('name', sa.VARCHAR(length=1000), autoincrement=False, nullable=True), sa.Column('instructorId', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('description', sa.VARCHAR(length=10000), autoincrement=False, nullable=True), sa.Column('semester', sa.VARCHAR(length=100), autoincrement=False, nullable=True), sa.Column('organization', sa.VARCHAR(length=100), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['instructorId'], ['Instructor.id'], name='Course_instructorId_fkey'), sa.PrimaryKeyConstraint('id', name='Course_pkey'), postgresql_ignore_search_path=False) op.create_table('Instructor', sa.Column('id', sa.INTEGER(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['id'], ['User.id'], name='Instructor_id_fkey'), sa.PrimaryKeyConstraint('id', name='Instructor_pkey'), postgresql_ignore_search_path=False) op.create_table( 'File', sa.Column( 'id', sa.INTEGER(), server_default=sa.text('nextval(\'"File_id_seq"\'::regclass)'), autoincrement=True, nullable=False), sa.Column('name', sa.VARCHAR(length=1000), autoincrement=False, nullable=True), sa.Column('fileType', sa.VARCHAR(length=100), autoincrement=False, nullable=True), sa.Column('data', postgresql.BYTEA(), autoincrement=False, nullable=True), sa.Column('userId', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('assignmentId', sa.INTEGER(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='File_pkey')) op.create_table( 'Student', sa.Column('id', sa.INTEGER(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['id'], ['User.id'], name='Student_id_fkey'), sa.PrimaryKeyConstraint('id', name='Student_pkey')) op.create_table( 'UserOrganizations', sa.Column('organizationId', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('userId', sa.INTEGER(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['organizationId'], ['Organization.id'], name='UserOrganizations_organizationId_fkey', ondelete='CASCADE'), sa.ForeignKeyConstraint(['userId'], ['User.id'], name='UserOrganizations_userId_fkey', ondelete='SET NULL'), sa.PrimaryKeyConstraint('organizationId', 'userId', name='UserOrganizations_pkey')) op.create_table( 'Organization', sa.Column('id', sa.INTEGER(), server_default=sa.text( 'nextval(\'"Organization_id_seq"\'::regclass)'), autoincrement=True, nullable=False), sa.Column('name', sa.VARCHAR(length=1000), autoincrement=False, nullable=True), sa.Column('adminId', sa.INTEGER(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['adminId'], ['Admin.id'], name='Organization_adminId_fkey'), sa.PrimaryKeyConstraint('id', name='Organization_pkey')) op.create_table( 'Module', sa.Column( 'id', sa.INTEGER(), server_default=sa.text('nextval(\'"Module_id_seq"\'::regclass)'), autoincrement=True, nullable=False), sa.Column('name', sa.VARCHAR(length=1000), autoincrement=False, nullable=True), sa.Column('courseId', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('description', sa.VARCHAR(length=1000), autoincrement=False, nullable=True), sa.Column('fileLoc', sa.INTEGER(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['courseId'], ['Course.id'], name='Module_courseId_fkey'), sa.PrimaryKeyConstraint('id', name='Module_pkey')) op.create_table( 'Announcement', sa.Column('id', sa.INTEGER(), server_default=sa.text( 'nextval(\'"Announcement_id_seq"\'::regclass)'), autoincrement=True, nullable=False), sa.Column('name', sa.VARCHAR(length=1000), autoincrement=False, nullable=True), sa.Column('description', sa.VARCHAR(length=1000), autoincrement=False, nullable=True), sa.Column('subject', sa.VARCHAR(length=1000), autoincrement=False, nullable=True), sa.Column('dateTime', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), sa.Column('courseId', sa.INTEGER(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['courseId'], ['Course.id'], name='Announcement_courseId_fkey'), sa.PrimaryKeyConstraint('id', name='Announcement_pkey')) op.create_table( 'Message', sa.Column( 'id', sa.INTEGER(), server_default=sa.text('nextval(\'"Message_id_seq"\'::regclass)'), autoincrement=True, nullable=False), sa.Column('message', sa.VARCHAR(length=100), autoincrement=False, nullable=False), sa.Column('senderId', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('recipientId', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('dateTime', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), sa.Column('isRead', sa.BOOLEAN(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['recipientId'], ['User.id'], name='Message_recipientId_fkey', ondelete='SET NULL'), sa.ForeignKeyConstraint(['senderId'], ['User.id'], name='Message_senderId_fkey', ondelete='CASCADE'), sa.PrimaryKeyConstraint('id', name='Message_pkey'))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('users', 'password', existing_type=postgresql.BYTEA(), nullable=True)
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('webhook_base', 'ssh_username') op.drop_column('webhook_base', 'ssh_key') op.add_column('Course', sa.Column('ssh_key', postgresql.BYTEA(), autoincrement=False, nullable=True)) op.add_column('Course', sa.Column('ssh_username', sa.VARCHAR(), autoincrement=False, nullable=True))
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('user_profiles', sa.Column('pic', postgresql.BYTEA(), autoincrement=False, nullable=True)) op.drop_column('user_profiles', 'date_joined')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'nio_megolm_inbound_session', sa.Column('session_id', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('sender_key', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('fp_key', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('room_id', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('session', postgresql.BYTEA(), autoincrement=False, nullable=False), sa.Column('forwarded_chains', postgresql.BYTEA(), autoincrement=False, nullable=False), sa.PrimaryKeyConstraint('session_id', name='nio_megolm_inbound_session_pkey')) op.create_table( 'nio_olm_session', sa.Column('session_id', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('sender_key', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('session', postgresql.BYTEA(), autoincrement=False, nullable=False), sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), sa.Column('last_used', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), sa.PrimaryKeyConstraint('session_id', name='nio_olm_session_pkey')) op.create_table( 'nio_outgoing_key_request', sa.Column('request_id', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('session_id', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('room_id', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('algorithm', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.PrimaryKeyConstraint('request_id', name='nio_outgoing_key_request_pkey')) op.create_table( 'nio_device_key', sa.Column('user_id', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('device_id', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('display_name', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('deleted', sa.BOOLEAN(), autoincrement=False, nullable=False), sa.Column('keys', postgresql.BYTEA(), autoincrement=False, nullable=False), sa.PrimaryKeyConstraint('user_id', 'device_id', name='nio_device_key_pkey')) op.create_table( 'nio_account', sa.Column('user_id', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('device_id', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('shared', sa.BOOLEAN(), autoincrement=False, nullable=False), sa.Column('sync_token', sa.TEXT(), autoincrement=False, nullable=False), sa.Column('account', postgresql.BYTEA(), autoincrement=False, nullable=False), sa.PrimaryKeyConstraint('user_id', 'device_id', name='nio_account_pkey'))
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table( 'companies', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=64), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('currency', sa.String(length=10), nullable=False), sa.Column('logo_url', sa.String(length=4096), nullable=True), sa.PrimaryKeyConstraint('id')) op.create_table( 'clients', sa.Column('id', sa.Integer(), nullable=False), sa.Column('company_id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=64), nullable=False), sa.Column('contacts', postgresql.ARRAY(sa.String()), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint( ['company_id'], ['companies.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name', 'company_id')) op.create_table( 'users', sa.Column('id', sa.Integer(), nullable=False), sa.Column('company_id', sa.Integer(), nullable=False), sa.Column('username', sa.String(length=64), nullable=False), sa.Column('email', sa.String(length=255), nullable=False), sa.Column('password', postgresql.BYTEA(length=255), nullable=False), sa.Column('is_admin', sa.Boolean(), nullable=False), sa.Column('activation_token', postgresql.BYTEA(), nullable=False), sa.Column('reset_password_token', postgresql.BYTEA(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint( ['company_id'], ['companies.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('email')) op.create_table( 'proposals', sa.Column('id', sa.Integer(), nullable=False), sa.Column('company_id', sa.Integer(), nullable=False), sa.Column('client_id', sa.Integer(), nullable=True), sa.Column('share_uid', sa.String(length=10), nullable=False), sa.Column('title', sa.String(length=100), nullable=False), sa.Column('tags', postgresql.ARRAY(sa.String()), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('changed_status_at', sa.DateTime(), nullable=False), sa.Column('status', sa.Enum('draft', 'sent', 'won', 'lost', 'trash', name='ProposalStatusEnum'), nullable=False), sa.Column('cover_image_url', sa.String(length=2048), nullable=False), sa.ForeignKeyConstraint( ['client_id'], ['clients.id'], ), sa.ForeignKeyConstraint( ['company_id'], ['companies.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('share_uid')) op.create_table( 'blocks', sa.Column('uid', postgresql.UUID(), nullable=False), sa.Column('proposal_id', sa.Integer(), nullable=True), sa.Column('type', sa.Enum('section', 'paragraph', 'subtitle', 'uli', 'oli', 'image', 'cost_table', 'quote', 'embed', name='BlockTypeEnum'), nullable=False), sa.Column('data', postgresql.JSONB(), nullable=False), sa.Column('ordering', sa.Integer(), nullable=False), sa.Column('version', sa.Integer(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint( ['proposal_id'], ['proposals.id'], ), sa.PrimaryKeyConstraint('uid')) op.create_table( 'proposal_last_seen', sa.Column('id', sa.Integer(), nullable=False), sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('proposal_id', sa.Integer(), nullable=False), sa.Column('seen_at', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint( ['proposal_id'], ['proposals.id'], ), sa.ForeignKeyConstraint( ['user_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('user_id', 'proposal_id')) op.create_table( 'shared_proposals', sa.Column('id', sa.Integer(), nullable=False), sa.Column('proposal_id', sa.Integer(), nullable=False), sa.Column('title', sa.String(), nullable=False), sa.Column('cover_image_url', sa.String(length=2048), nullable=False), sa.Column('version', sa.Integer(), nullable=False), sa.Column('sent_to', postgresql.ARRAY(sa.String()), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint( ['proposal_id'], ['proposals.id'], ), sa.PrimaryKeyConstraint('id')) op.create_table( 'comment_threads', sa.Column('id', sa.Integer(), nullable=False), sa.Column('proposal_id', sa.Integer(), nullable=False), sa.Column('block_uid', postgresql.UUID(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.Column('resolved', sa.Boolean(), nullable=False), sa.ForeignKeyConstraint(['block_uid'], ['blocks.uid'], ondelete='CASCADE', initially='DEFERRED', deferrable=True), sa.ForeignKeyConstraint(['proposal_id'], ['proposals.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id')) op.create_table( 'import_section_search', sa.Column('company_id', sa.Integer(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.Column('section_uid', postgresql.UUID(), nullable=False), sa.Column('proposal_title', sa.Unicode(), nullable=False), sa.Column('title', sa.Unicode(), nullable=False), sa.Column('ts_title', postgresql.TSVECTOR(), nullable=False), sa.Column('client', sa.Unicode(), nullable=False), sa.Column('all_content', sa.Unicode(), nullable=False), sa.Column('ts_all_content', postgresql.TSVECTOR(), nullable=False), sa.ForeignKeyConstraint( ['company_id'], ['companies.id'], ), sa.ForeignKeyConstraint(['section_uid'], ['blocks.uid'], ondelete='CASCADE', initially='DEFERRED', deferrable=True), sa.PrimaryKeyConstraint('section_uid')) op.create_table( 'shared_blocks', sa.Column('id', sa.Integer(), nullable=False), sa.Column('uid', postgresql.UUID(), nullable=False), sa.Column('shared_proposal_id', sa.Integer(), nullable=False), sa.Column('type', sa.Enum('section', 'paragraph', 'subtitle', 'uli', 'oli', 'image', 'cost_table', 'quote', 'embed', name='BlockTypeEnum'), nullable=False), sa.Column('data', postgresql.JSONB(), nullable=False), sa.Column('ordering', sa.Integer(), nullable=False), sa.ForeignKeyConstraint( ['shared_proposal_id'], ['shared_proposals.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('shared_proposal_id', 'uid')) op.create_table( 'comments', sa.Column('id', sa.Integer(), nullable=False), sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('thread_id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.Column('comment', sa.Unicode(), nullable=False), sa.ForeignKeyConstraint(['thread_id'], ['comment_threads.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint( ['user_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id')) op.create_table( 'shared_comment_threads', sa.Column('id', sa.Integer(), nullable=False), sa.Column('shared_proposal_id', sa.Integer(), nullable=False), sa.Column('block_id', sa.Integer(), nullable=False), sa.Column('block_uid', postgresql.UUID(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.Column('resolved', sa.Boolean(), nullable=False), sa.ForeignKeyConstraint( ['block_id'], ['shared_blocks.id'], ), sa.ForeignKeyConstraint( ['shared_proposal_id'], ['shared_proposals.id'], ), sa.PrimaryKeyConstraint('id')) op.create_table( 'shared_comments', sa.Column('id', sa.Integer(), nullable=False), sa.Column('username', sa.String(), nullable=False), sa.Column('from_client', sa.Boolean(), nullable=False), sa.Column('thread_id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.Column('comment', sa.Unicode(), nullable=False), sa.ForeignKeyConstraint( ['thread_id'], ['shared_comment_threads.id'], ), sa.PrimaryKeyConstraint('id'))