Comments (3)
I added some test cases to cover the two behaviors you mentioned, but it turns out neither is a bug. Both arise from how the underlying YAML parser treats the input data.
The first issue, that of inline comments causing trouble, is due to the fact that YAML parsers do "scalar folding" of values, converting newlines to spaces, unless explicitly told that values are to be treated as literals. The reason is that in YAML, indentation indicates an increase in structure depth, and the content at that depth is the interpreted as a YAML tree, and a literal is usually not what the subsequent tree value is intended to represent. So to fix this, you have to put a pipe following the key name and colon. It also turns out the old me that wrote this code knew about this confusion and even added a note to the README about it. So an example is
foo: |
bar
baz
and in that example, the newline in between bar
and baz
will be preserved. For dbmigrations
, this is almost always what you want.
As for the second behavior, since YAML uses colons as delimiters to separate keys and values, and because dashes have special meaning to denote the beginning of a node in a list, the parser interpretes "-- foo:" as YAML. Again, this arises from the lack of a pipe specifying that the value is a literal. If you add that, the problem goes away.
The other advantage to doing this in both cases is that the structure of the SQL is preserved, and that will prevent the lack of newlines from confusing the SQL parser in the database engine.
from dbmigrations.
I also updated the migration serialization to emit ASCII literal markings by default in 9692cc9, so that should reduce the chance of this being bothersome.
from dbmigrations.
whoa! That's a somewhat unfortunate confluence of features, and an interesting problem to think about...
from dbmigrations.
Related Issues (20)
- HDBC dependency too restrictive HOT 1
- Linear Migrations HOT 4
- Schema dumps HOT 4
- Poor documentation with regard to set up HOT 9
- How to fake migrations? HOT 3
- dbmigrations-0.8.1 can't compile its test suite HOT 3
- Support `moo --version` HOT 1
- Add MySQL backend tests HOT 1
- Total encapsulation of migration information HOT 8
- Build flags to select db backend? (e.g., -fmysql) HOT 10
- Installation fails if pg_config is not present HOT 1
- PostgreSQL: If a migration changes schema, migration fails to insert into installed_migrations HOT 3
- Running migrations from within server HOT 10
- YAML migration files named .txt HOT 2
- Document why the cli tool is called "moo" HOT 2
- Since dbmigrations 2.1.0, migrations with . in the name are truncated HOT 2
- Document how to use dbmigrations programmatically. HOT 6
- aeson <2 dependency relaxation: What would it take to remove that restriction? HOT 2
- Unrecognized field found when running migration HOT 2
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 dbmigrations.