Git Product home page Git Product logo

Comments (11)

pleerock avatar pleerock commented on May 22, 2024 1

You can access driver and its query builder via connection object and via connection manager. If you have complexities with it, I recommend you to use native driver (or easiest for you). Migration support is something that is next in my plan and Im planning to ship it this month.

from typeorm.

pleerock avatar pleerock commented on May 22, 2024

totally needed feature, one of the most complex that is left. Im still thinking what is the best way to organize this process. @19majkel94 do you have experience using migrations in other orms, how they look like and what is the best approach?

from typeorm.

MichalLytek avatar MichalLytek commented on May 22, 2024

Oh, unfortunately not yet, I'm a beginner with no big experience - I just like new, good languages/frameworks/tools 😉 I even don't get the migration concept well so I'm not able to help you with this feature.

from typeorm.

dreamersp avatar dreamersp commented on May 22, 2024

Have you considered using umzug from Sequelize? It allows for a fast integration of up() and down() functions executed consecutively and log which migration ran. Only that as DB it integrates with Sequelize or a JSON file log.

from typeorm.

pleerock avatar pleerock commented on May 22, 2024

its easy to implement something that runs up and down functions... The problem is that users will do inside them... Will they write raw sql code there? Or should orm provide good api to write migrations? Or should orm generate migrations by itself if its possible? Or anything else?

from typeorm.

dreamersp avatar dreamersp commented on May 22, 2024

I was thinking more of a first minimum working version that can be used for producing the models and it's changes maybe with a few predefined queries like createColumn(), dropColum(), and or just raw queries.

For me the ideal TS ORM shall resemble and improve what EntityFramework offers in C# world. But that seems like a big endeavour even though you're half the way into it.
What I found lacking in Javascript ORMs is general scaffolding/self migration generation, nice clean models, and annotation based enrichment. As I mentioned I think typeorm is changing this and I found it resemblant to EntityFramework in it's way of creating models and querying.

Never the less, as you already found a way of tracking changes of the models vs DB and writing SQL to reflect those changes, it would be a first step to encapsulate that SQL into a migration/file and run it from command line.

Even EF haven't offered a de-facto way of using their models into it's generated migrations, that's an improvement I would recommend after a working basic scheme migration. It may be straight away to make or not.

from typeorm.

thynson avatar thynson commented on May 22, 2024

I think Raw SQL is acceptable at first time. While generated migration script is sometimes unreliable.

from typeorm.

pleerock avatar pleerock commented on May 22, 2024

agree. you can use some third party package for example db-migrate until I implement this. If of course nobody want to contribute :)

from typeorm.

dreamersp avatar dreamersp commented on May 22, 2024

Hi there again!
I was wondering how to implement a first self-generated script using your SchemaBuilder @pleerock . Reading the code related to SchemaBuilder, then QueryBuilder and come to think that if we can inject a string writer/array writer class every time query() is called (at least in MysqlQueryRunner) instead of using a native connection to the Database Driver, we could get the SQL statements to insert into an scaffold up() function.
Maybe an extension to the native connection and allowing in MysqlDriver to overwrite it's databaseConnection with a provided connection class in the constructor.

It goes beyond my understanding of the code(and sadly my available time) how to inject such class and discriminate the schema checking queries needed to generate the change queries(use a regex discriminating SELECTs?) and intercept only the later triggered in a cli based tool.

from typeorm.

pleerock avatar pleerock commented on May 22, 2024

implemented in #120 need your feedback guys

from typeorm.

pleerock avatar pleerock commented on May 22, 2024

added docs here and updated example how to use it. released in 0.0.5

from typeorm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.