Add Mysql and Postgres schema (SQL dump)

This commit is contained in:
Frederic Guillot
2015-10-05 22:10:25 -04:00
parent 793763681d
commit ca62d68788
6 changed files with 2406 additions and 0 deletions

View File

@@ -88,4 +88,17 @@ test-postgres:
unittest: test-sqlite test-mysql test-postgres
sql:
@ pg_dump --schema-only --no-owner --file app/Schema/Sql/postgres.sql kanboard
@ mysqldump -uroot --quote-names --no-create-db --skip-comments --no-data --single-transaction kanboard | sed 's/ AUTO_INCREMENT=[0-9]*//g' > app/Schema/Sql/mysql.sql
@ php -r "echo 'INSERT INTO users (username, password, is_admin) VALUES (\'admin\', \''.password_hash('admin', PASSWORD_DEFAULT).'\', \'1\');';" | \
tee -a app/Schema/Sql/postgres.sql app/Schema/Sql/mysql.sql >/dev/null
@ let mysql_version=`echo 'select version from schema_version;' | mysql -N -uroot kanboard` ;\
echo "INSERT INTO schema_version VALUES ('$$mysql_version');" >> app/Schema/Sql/mysql.sql
@ let pg_version=`psql -U postgres -A -c 'copy(select version from schema_version) to stdout;' kanboard` ;\
echo "INSERT INTO schema_version VALUES ('$$pg_version');" >> app/Schema/Sql/postgres.sql
.PHONY: all