Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/db-journey/mysql-driver

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/db-journey/mysql-driver

  • v1.0.1
  • Source
  • Go
  • Socket score

Version published
Created
Source

MySQL Driver

  • Runs migrations in transactions. That means that if a migration fails, it will be safely rolled back.
  • Tries to return helpful error messages.
  • Stores migration version details in table schema_migrations. This table will be auto-generated.
  • Safe to run concurrently (schema_migrations table is locked during migrations)

Migrations SQL formatting

Each SQL statement MUST end with semicolon (;) FOLLOWED BY NEWLINE ! Whole migration will be executed inside transaction by default. Place SQL between "-- TXBEGIN" and "-- TXEND" comments for custom transaction:

  • you CAN have multiple separate transactions in single migration
  • any SQL not wrapped into TXBEGIN - TXEND will be executed without transaction. Add "-- NOTX" comment above all SQL to disable default transaction. NOTE: it's redundant when TXBEGIN/TXEND is used.

Usage

migrate -url mysql://user@tcp(host:port)/database -path ./db/migrations create add_field_to_table
migrate -url mysql://user@tcp(host:port)/database -path ./db/migrations up
migrate help # for more info

See full DSN (Data Source Name) documentation.

SSL

The MySQL driver will set a TLS config if the following env variables are set:

  • MYSQL_SERVER_CA
  • MYSQL_CLIENT_KEY
  • MYSQL_CLIENT_CERT

TODO: deprecate - library code should not rely on environment variables

Authors

FAQs

Package last updated on 09 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc