dbmate | : rocket : A lightweight , framework-agnostic database | Database library
kandi X-RAY | dbmate Summary
kandi X-RAY | dbmate Summary
Dbmate is a database migration tool, to keep your database schema in sync across multiple developers and your production servers. It is a standalone command line tool, which can be used with Go, Node.js, Python, Ruby, PHP, or any other language or framework you are using to write database-backed applications. This is especially helpful if you are writing many services in different languages, and want to maintain some sanity with consistent development tools. For a comparison between dbmate and other popular database schema migration tools, please see the Alternatives table.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of dbmate
dbmate Key Features
dbmate Examples and Code Snippets
Community Discussions
Trending Discussions on dbmate
QUESTION
dbmate
(link) is an awesome CLI tool to manage schema migrations in SQL databases. Our team has adopted it, but we have some pre-existing projects that already have PostgreSQL databases. dbmate
is great if used from the onset of a project, but is there any straightforward way to port a pre-existing database into dbmate
? Can't find anything about it on the docs.
We have JetBrains tools like DataGrip/PyCharm pro at our disposable, so if there's some way to export the DB into a schema file that dbmate
could then somehow manage, even if hacky, that solution would be fine.
ANSWER
Answered 2020-Jul-15 at 22:23You can run dbmate dump
to get the existing schema and add it to a "fake" migration. Here's how:
- Run
dbmate dump
which will generatedb/schema.sql
- rename it toimport.sql
- Run
dbmate new import
which will generate an "import" migration - Run
dbmate new start
which will generate a "start" migration - Add anything you like to the "start" migration or leave it blank
- Run
dbmate up
- Modify
import.sql
if necessary and then move its contents to the "import" migration
Now the dbmate "cursor" is on the "start" migration, as if the "import" migration already happened. You can continue making new migrations on top of the existing schema.
This was also a question on dbmate's GitHub issue tracker.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install dbmate
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page