prahladyeri / VisualAlchemist

Open source database diagramming and automation tool
GNU General Public License v3.0
728 stars 57 forks source link

There is any intent to export migration scripts for Alembic? #16

Closed johnnywell closed 5 years ago

johnnywell commented 9 years ago

I'm interested on this feature and if there is any intent to create it maybe I would help if I could.

prahladyeri commented 9 years ago

Sorry for the late reply, I was busy. Is Alembic any well-known ORM like sqlalchemy? If you can assure me that you will make use of this export feature in a real/production environment, I'll surely develop it.

johnnywell commented 9 years ago

I'm not sure about Alembic popularity, but as far as I know it's the only migration tool which has auto generation of migration scripts.

prahladyeri commented 8 years ago

@johnnywell I was busy with work these last few months, but I've now taken a keen interest again in VA development. Please confirm if you are still around here and would like to have Alembic integration in VA and I'll do it.

johnnywell commented 8 years ago

Although I'm not working with VA right now I think it's a great feature to have. If it wouldn't jeopardize your time to spend on some other cool stuff I would be happy to see it in action.

Johnny Wellington dos Santos Cel.: +55 41 98735909 E-mail: johnny.w.santos@gmail.com

Em 28 de fev de 2016 19:46 -0300, Prahlad Yerinotifications@github.com, escreveu:

@johnnywell(https://github.com/johnnywell)I've taken a keen interest again in Visual Alchemist development. Please confirm if you are still around here and would like to have Alembic integration in VA and I'll do it.

— Reply to this email directly orview it on GitHub(https://github.com/prahladyeri/VisualAlchemist/issues/16#issuecomment-189962166).

prahladyeri commented 8 years ago

@johnnywell After going through their Bitbucket repo, it looks like Alembic is also a migration tool like VA that takes SQLAlchemy models and outputs the CREATE/ALTER scripts (similar to what VA does). I'm not sure how you intend to use VA along with Alembic, they both seem to be doing the same things!

johnnywell commented 8 years ago

My intent would be load the current schema on VA, make my changes and export it as a Alembic migration, so I wouldn't need to create a migration script by hand.

Em ter, 1 de mar de 2016 às 13:57, Prahlad Yeri notifications@github.com escreveu:

@johnnywell https://github.com/johnnywell After going through their Bitbucket repo https://bitbucket.org/zzzeek/alembic, it looks like Alembic is also a migration tool like VA that takes SQLAlchemy models and outputs the CREATE/ALTER scripts (similar to what VA) does. I'm not sure how you intend to use VA along with Alembic, they both seem to be doing the same things!

— Reply to this email directly or view it on GitHub https://github.com/prahladyeri/VisualAlchemist/issues/16#issuecomment-190811284 .

prahladyeri commented 8 years ago

k, I understand. But wouldn't it be much simpler and easier to just directly export from VA to SQLAlchemy, instead of VA->Alembic-script->SQLAlchemy?

johnnywell commented 8 years ago

Sure, but sometimes you already has a project using Alembic, and you just want to use the coolest VA.

Em ter, 1 de mar de 2016 às 16:07, Prahlad Yeri notifications@github.com escreveu:

k, I understand. But wouldn't it be much simpler and easier to just directly export from VA to SQLAlchemy, instead of VA->Alembic->SQLAlchemy?

— Reply to this email directly or view it on GitHub https://github.com/prahladyeri/VisualAlchemist/issues/16#issuecomment-190855043 .

prahladyeri commented 8 years ago

After skimming through the alembic docs, I understand that it involves generation of upgrade/downgrade scripts to refactor an SQLAlchemy backend accordingly. For example, like this one:

# revision identifiers, used by Alembic.
revision = 'ae1027a6acf'
down_revision = '1975ea83b712'
from alembic import op
import sqlalchemy as sa

def upgrade():
    op.add_column('account', sa.Column('last_transaction_date', sa.DateTime))

def downgrade():
    op.drop_column('account', 'last_transaction_date')

So basically, VA cannot treat alembic as just another output fomat like raw mysql or raw postgres. VA has to "remember" the last export made and depending on that generate this upgrade script automatically depending on what columns were added/removed, is my understanding correct?

johnnywell commented 8 years ago

That's correct.

Em ter, 1 de mar de 2016 às 17:12, Prahlad Yeri notifications@github.com escreveu:

After skimming through the alembic docs https://alembic.readthedocs.org/en/latest/tutorial.html, I understand that it involves generation of upgrade/downgrade scripts to refactor an SQLAlchemy backend accordingly. For example, like this one:

revision identifiers, used by Alembic.

revision = 'ae1027a6acf' down_revision = '1975ea83b712' from alembic import op import sqlalchemy as sa

def upgrade(): op.add_column('account', sa.Column('last_transaction_date', sa.DateTime))

def downgrade(): op.drop_column('account', 'last_transaction_date')

So basically, VA cannot treat alembic as just another output fomat. VA has to "remember" the last export made and depending on generate this upgrade script automatically depending on what columns were added/removed, is my understanding correct?

— Reply to this email directly or view it on GitHub https://github.com/prahladyeri/VisualAlchemist/issues/16#issuecomment-190882905 .

prahladyeri commented 8 years ago

Cool! You've given me a whole new direction to work - Database versioning in VA! I think the version tracking will not just be useful for SA, but also for other ORMS and even raw mysql/postgres too.

johnnywell commented 8 years ago

Nice, I think you could use some abstraction layer to support others migrations tools as well, like Django ORM migration for instance, which is not SQLAlchemy necessarily related. VA could turn into a even greater tool!

Em ter, 1 de mar de 2016 às 17:39, Prahlad Yeri notifications@github.com escreveu:

Cool! You've given me a whole new direction to work - Database versioning in VA! I think the version tracking will not just be useful for SA, but also for other ORMS and even raw mysql/postgres too.

— Reply to this email directly or view it on GitHub https://github.com/prahladyeri/VisualAlchemist/issues/16#issuecomment-190891150 .

kinduff commented 8 years ago

Pretty cool that the tool exports to JSON.

This feature would need just an extra module to parse the JSON as a Django, Rails or SQLAlchemy migration files using the data from the fields to fill out a template (handlebars, mustache, etc) for each of the desired ORMs.

I can submit a PR with the Rails migration export and template if someone contributes with the middleware module and the templating integration.

prahladyeri commented 8 years ago

@kinduff Django ORM export is on the way, coming soon! I'm currently trying to modularize the jQuery soup inside app.js and other fragmented files using Backbone.js or something.

prahladyeri commented 5 years ago

Closing as there has been no activity. I've lost interest in this project, if anyone wants to take this over, please contact me.