adlio / schema Goto Github PK
View Code? Open in Web Editor NEWEmbedded schema migration package for Go
License: MIT License
Embedded schema migration package for Go
License: MIT License
Hi!
I was working on adding SQLite support. It is all pretty straightforward except for locking. While I can work to add a lock scheme, it's necessarily going to involve polling to try to write the sentinel value, checking I got the lock, handling stale locks, etc. My thought: is it worth it for SQLite? Given the use cases of SQLite, that there can only be one writer, and the migrations are done in a transaction, I think anything beyond a no-op (""
) lock/unlock is of questionable value. What do you think?
(v1.1.7) file.go
uses "path" instead of "path/filepath" for a few path-related operations.
Because Windows uses a backslash for the path separator, the file path is not properly interpreted. This results in the migration ID
to include the entire absolute path instead of just the filename.
Two functions are involved: MigrationIDFromFilename
and MigrationsFromDirectoryPath
.
Changing the following appears to correct the problem (although only tested under Windows):
path.Base()
to filepath.Base()
path.Ext()
to filepath.Ext()
path.Join()
to filepath.Join()
Commit a7bc68f appears to have changed the methods of the Migrator
type to accept a pointer rather than a value. The NewMigrator
constructor, however, still returns a Migrator
by value, which means that a call like:
err := schema.NewMigrator().Apply(x, y)
(which used to work) will now fail because the Migrator
is in a temporary and the compiler will not desugar the address.
For now I can work around this by rewriting expressions like the above as:
m := schema.NewMigrator()
err := m.Apply(x, y)
but I think the value returned by the constructor should have the correct type for use by the methods.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.