sqlite-squish

module
v0.0.0-...-e98148d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2018 License: MIT

README

sqlite-squish

Command line tools to turn one or more plain-text *.sql files into a sqlite database and back again into text.

Problem Statement

I work on a game that stores its game data (ie, level geometry, animations, item type definitions, skills, etc) in a sqlite database. As part of that work, I often commit changes to the sqlite database. Because sqlite databases are binary files, no meaningful diffs can be committed, and merges cannot be performed.

My first approach to solving this was to use the sqlite .dump command to export the database, which worked reasonably well. The place where I'm unsatisfied with this approach though is that I have no control over how the data is exported; I just get a single output file, which is difficult to read and edit. As the database size grew, the dumped file became more and more unwieldy. Ideally there would be one output file per table.

I also need to be able to compose one or more .sql files into a sqlite database, to regenerate the database after cloning, merging or pulling.

This repository holds my solution to that problem.

Commands

sqlite-squish This is a fully featured tool to convert from one of:

  • one or more sql statements piped in via stdin
  • a sqlite database
  • or a directory of *.sql files

and to one of:

  • stdout
  • a sqlite database
  • or a directory of *.sql files.

It has a several flags to drive behaviour due to it's more complicated feature set.

compose-sqlite This is a simple command to compose a directory of *.sql files into a sqlite database. It takes one argument to specify the directory to compose.

decompose-sqlite This is a simple command to decompose a sqlite database into a directory of *.sql files. It takes one argument to specify the name of the database to decompose.

Directories

Path Synopsis
cmd
compose-sqlite command
program compose-sqlite takes a directory of .sql text files and outputs a binary sqlite database file.
program compose-sqlite takes a directory of .sql text files and outputs a binary sqlite database file.
decompose-sqlite command
program decompose-sqlite takes a binary sqlite database file and decomposes it into a set of text *.sql files Example: decompose-sqlite database.sqlite creates a file for every table in database.sqlite under database.sql/ that contains a CREATE TABLE statement and zero or more INSERT INTO statements.
program decompose-sqlite takes a binary sqlite database file and decomposes it into a set of text *.sql files Example: decompose-sqlite database.sqlite creates a file for every table in database.sqlite under database.sql/ that contains a CREATE TABLE statement and zero or more INSERT INTO statements.
sqlite-squish command
command sqlite-squish provides an interface to convert between SQL statements in plain-text *.sql files and sqlite databases.
command sqlite-squish provides an interface to convert between SQL statements in plain-text *.sql files and sqlite databases.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL