This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.1' | |
services: | |
postgres: | |
image: postgres:12.3 | |
restart: always | |
environment: | |
POSTGRES_USER: gabriel | |
POSTGRES_DB: contabo | |
POSTGRES_PASSWORD: Contabo2019!Gabriel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script will migrate schema and data from a SQLite3 database to PostgreSQL. | |
# Schema translation based on http://stackoverflow.com/a/4581921/1303625. | |
# Some column types are not handled (e.g blobs). | |
SQLITE_DB_PATH=$1 | |
SQLITE_DUMP_FILE="sqlite_data.sql" | |
sqlite3 $SQLITE_DB_PATH .dump | sed -e 's/integer NOT NULL PRIMARY KEY AUTOINCREMENT/SERIAL PRIMARY KEY/g' | sed -e 's/PRAGMA foreign_keys=OFF;//' | sed -e 's/unsigned big int/BIGINT/g' | sed -e 's/UNSIGNED BIG INT/BIGINT/g' | sed -e 's/BIG INT/BIGINT/g' | sed -e 's/UNSIGNED INT(10)/BIGINT/g' | sed -e 's/BOOLEAN/SMALLINT/g' | sed -e 's/boolean/SMALLINT/g' | sed -e 's/UNSIGNED BIG INT/INTEGER/g' | sed -e 's/INT(3)/INT2/g' | sed -e 's/DATETIME/TIMESTAMP/g' | sed -e 's/datetime/TIMESTAMP/g' > $SQLITE_DUMP_FILE |