Ian Fijolek
28f081c8d0
All checks were successful
continuous-integration/drone/push Build is passing
Including databases
32 lines
672 B
Bash
Executable File
32 lines
672 B
Bash
Executable File
#! /bin/sh
|
|
set -ex
|
|
|
|
# Create flat file
|
|
echo "Hello" > /data/test.txt
|
|
|
|
# Create Sqlite database
|
|
touch /data/test_database.db
|
|
sqlite3 /data/test_database.db <<-EOF
|
|
CREATE TABLE test_table (
|
|
id integer PRIMARY KEY,
|
|
data text NOT NULL
|
|
);
|
|
|
|
INSERT INTO test_table(data)
|
|
VALUES ("Test row");
|
|
EOF
|
|
|
|
# Create MySql database
|
|
until mysql --host "$MYSQL_HOST" --user "$MYSQL_USER" --password="$MYSQL_PWD" --execute "SHOW DATABASES;"; do
|
|
sleep 1
|
|
done
|
|
mysql --host "$MYSQL_HOST" --user "$MYSQL_USER" --password="$MYSQL_PWD" main <<EOF
|
|
CREATE TABLE test_table (
|
|
id integer AUTO_INCREMENT PRIMARY KEY,
|
|
data text NOT NULL
|
|
);
|
|
|
|
INSERT INTO test_table(data)
|
|
VALUES ("Test row");
|
|
EOF
|