mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Add a Makefile to build an SQLite-compatible schema
Allow for automatically converting the schema into a schema that works with SQLite by running `make` from the schema/ subdirectory. Use the new Makefile in the test suite. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
48f2837525
commit
da4bd3b59e
3 changed files with 18 additions and 10 deletions
11
schema/Makefile
Normal file
11
schema/Makefile
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
aur-schema-sqlite.sql: aur-schema.sql
|
||||||
|
sed \
|
||||||
|
-e 's/ ENGINE = InnoDB//' \
|
||||||
|
-e 's/ [A-Z]* UNSIGNED NOT NULL AUTO_INCREMENT/ INTEGER NOT NULL/' \
|
||||||
|
-e 's/([0-9, ]*) UNSIGNED / UNSIGNED /' \
|
||||||
|
$< >$@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf aur-schema-sqlite.sql
|
||||||
|
|
||||||
|
.PHONY: clean
|
|
@ -1,6 +1,10 @@
|
||||||
|
FOREIGN_TARGETS = ../schema/aur-schema-sqlite.sql
|
||||||
T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
|
T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
|
||||||
|
|
||||||
check: $(T)
|
check: $(FOREIGN_TARGETS) $(T)
|
||||||
|
|
||||||
|
$(FOREIGN_TARGETS):
|
||||||
|
$(MAKE) -C $(dir $@) $(notdir $@)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) -r test-results/
|
$(RM) -r test-results/
|
||||||
|
@ -8,4 +12,4 @@ clean:
|
||||||
$(T):
|
$(T):
|
||||||
@echo "*** $@ ***"; $(SHELL) $@
|
@echo "*** $@ ***"; $(SHELL) $@
|
||||||
|
|
||||||
.PHONY: check clean $(T)
|
.PHONY: check $(FOREIGN_TARGETS) clean $(T)
|
||||||
|
|
|
@ -106,14 +106,7 @@ export SSH_CLIENT SSH_CONNECTION SSH_TTY
|
||||||
|
|
||||||
# Initialize the test database.
|
# Initialize the test database.
|
||||||
rm -f aur.db
|
rm -f aur.db
|
||||||
sed \
|
sqlite3 aur.db <"$TOPLEVEL/schema/aur-schema-sqlite.sql"
|
||||||
-e '/^DROP DATABASE /d' \
|
|
||||||
-e '/^CREATE DATABASE /d' \
|
|
||||||
-e '/^USE /d' \
|
|
||||||
-e 's/ ENGINE = InnoDB//' \
|
|
||||||
-e 's/ [A-Z]* UNSIGNED NOT NULL AUTO_INCREMENT/ INTEGER NOT NULL/' \
|
|
||||||
-e 's/([0-9, ]*) UNSIGNED / UNSIGNED /' \
|
|
||||||
"$TOPLEVEL/schema/aur-schema.sql" | sqlite3 aur.db
|
|
||||||
|
|
||||||
echo "INSERT INTO Users (ID, UserName, Passwd, Email, AccountTypeID) VALUES (1, 'user', '!', 'user@localhost', 1);" | sqlite3 aur.db
|
echo "INSERT INTO Users (ID, UserName, Passwd, Email, AccountTypeID) VALUES (1, 'user', '!', 'user@localhost', 1);" | sqlite3 aur.db
|
||||||
echo "INSERT INTO Users (ID, UserName, Passwd, Email, AccountTypeID) VALUES (2, 'tu', '!', 'tu@localhost', 2);" | sqlite3 aur.db
|
echo "INSERT INTO Users (ID, UserName, Passwd, Email, AccountTypeID) VALUES (2, 'tu', '!', 'tu@localhost', 2);" | sqlite3 aur.db
|
||||||
|
|
Loading…
Add table
Reference in a new issue