Coder Social home page Coder Social logo

Transaction support about ragtime HOT 4 CLOSED

weavejester avatar weavejester commented on May 29, 2024
Transaction support

from ragtime.

Comments (4)

danielcompton avatar danielcompton commented on May 29, 2024

@codahale just to confirm, are you talking about running multiple different migrations inside a single transaction, or running a single migration inside a transaction?

from ragtime.

codahale avatar codahale commented on May 29, 2024

Sorry if I wasn't clear; I meant running all of the statements of a individual migration in a single, per-migration transaction.

I think it should be as simple as wrapping execute-sql! in a transaction, but it's possible some databases which don't support transactional DDL may throw an exception.

from ragtime.

danielcompton avatar danielcompton commented on May 29, 2024

Is it possible to do this already with the current SQL migration support? I'm guessing this is the kind of thing you've already tried, but it doesn't work because each command is sent separately (hence this issue)?:

{:up   ["BEGIN"
        "CREATE TABLE foo (name VARCHAR(100))"
        "INSERT INTO foo VALUES ('alice'), ('bob')"
        "COMMIT"]
 :down ["DROP TABLE foo"]}

from ragtime.

codahale avatar codahale commented on May 29, 2024

I actually hadn't thought of that, but I can run transactional DDLs inside migration statements. Thanks for pointing that out; that totally solves my problem. I'll go ahead and close the issue.

from ragtime.

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.