Comments (8)
I think having the migrations be plain SQL files is very valuable. It means I can open them in my editor, edit the contents in the best way my editor can provide, get syntax highlightning, helpful formattting, maybe completion when connected to a database, execute statements line-by-line REPL style, etc. As soon as we stuff SQL text in a string we lose all that.
Have you considered the option of allowing multiple files per up/down migration, executed as separate commands in order by some sequence identifier? For example:
20120903221323-add-test-table.up.1.sql
20120903221323-add-test-table.up.2.sql
20120903221323-add-test-table.up.3.sql
from ragtime.
That's an interesting suggestion. Perhaps the syntax can be determined from the filename. So:
\.edn$
\.(up|down)\.sql$
\.(up|down)\.\d+\.sql$
The reason I might still keep the edn syntax is that it's more concise and needs little code. Additionally, if a multimethod is used based on the file extension, other formats can be supported.
from ragtime.
I'm all for supporting different formats, I appreciate my views are biased by my particular workflow etc so having this open to extension (with EDN and sql in the box) would be great.
Not exactly sure what the extension point would look like. Might be a challenge to just dispatch on extension as the SQL format with multiple files per migration would need to consider a set of files and order them. But I don't know what the logic for loading files currently looks like.
from ragtime.
We just take a list of files, group them by extension, and then send each group to a multimethod.
from ragtime.
I generally stick to one statement per file and just use the normal sequencing method to get this behavior. What's the intrinsic value in providing multiple statements in a file?
from ragtime.
Grouping statements allows the migration to be considered atomically. If one statement fails, the whole migration fails.
from ragtime.
Ah. Yeah that makes sense. I guess I haven't been doing much DML with ragtime yet. That use case wasn't in my head.
from ragtime.
Done (99edc4c).
from ragtime.
Related Issues (20)
- Migration strategy for continuous delivery HOT 3
- Catch and rethrow exceptions during migrations with more context? HOT 1
- Allow migrations to be clojure function instead on just sql HOT 2
- ragtime.strategy/ignore-future doesn't exist in the newest version 0.7.2 HOT 1
- Add clean option to rollback all migrations HOT 4
- Abstract out jdbc project HOT 8
- Read error on wildfly HOT 2
- illegal
- WARNING: An illegal reflective access operation has occurred HOT 3
- get-table-metadata* leaks a ResultSet
- Migration conflict on app restart HOT 2
- Throw more actionable "Conflict" exceptions?
- Upgrade ragtime.jdbc to use next-jdbc HOT 1
- next-jdbc: Discover that the migration table exists even if the name is quoted
- Make a new release with the support for quoted identifiers HOT 2
- No such var: next.jdbc.default-options/wrapped-connection? HOT 11
- Ragtime tries to run same migrations twice on Ubuntu 22.04 HOT 3
- Optimize performance of `ragtime.next-jdbc/ensure-migrations-table-exists` HOT 9
- Consider changing the SQL separator to support MySQL users for the better HOT 2
- Instructions on Concepts wiki page does not match `ragtime 0.8.1` behavior HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ragtime.