diff options
author | Badlop <badlop@process-one.net> | 2021-05-11 18:18:15 +0200 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2021-05-11 18:36:16 +0200 |
commit | 160cd11c8300a6dccb564b743b6dc250dfd8daa5 (patch) | |
tree | 40143bda6706a86fb26f553c8861f14f3a795c60 | |
parent | Document that update_sql command only supports postgresql (#3439) (diff) |
Minor fixes for new_sql_schema support in SQLite (#3303)
-rw-r--r-- | Makefile.in | 5 | ||||
-rw-r--r-- | src/ejabberd_sql_sup.erl | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/Makefile.in b/Makefile.in index c7b799ac7..ee2b36e3b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -212,13 +212,16 @@ $(sort $(call TO_DEST,$(MAIN_DIRS) $(DEPS_DIRS))): $(call TO_DEST,priv/sql/lite.sql): sql/lite.sql $(call TO_DEST,priv/sql) $(INSTALL) -m 644 $< $@ +$(call TO_DEST,priv/sql/lite.new.sql): sql/lite.new.sql $(call TO_DEST,priv/sql) + $(INSTALL) -m 644 $< $@ + $(call TO_DEST,priv/bin/captcha.sh): tools/captcha.sh $(call TO_DEST,priv/bin) $(INSTALL) -m 755 $(O_USER) $< $@ $(call TO_DEST,priv/lua/redis_sm.lua): priv/lua/redis_sm.lua $(call TO_DEST,priv/lua) $(INSTALL) -m 644 $< $@ -copy-files-sub2: $(call TO_DEST,$(DEPS_FILES) $(MAIN_FILES) priv/bin/captcha.sh priv/sql/lite.sql priv/lua/redis_sm.lua) +copy-files-sub2: $(call TO_DEST,$(DEPS_FILES) $(MAIN_FILES) priv/bin/captcha.sh priv/sql/lite.sql priv/sql/lite.new.sql priv/lua/redis_sm.lua) .PHONY: $(call TO_DEST,$(DEPS_FILES) $(MAIN_DIRS) $(DEPS_DIRS)) diff --git a/src/ejabberd_sql_sup.erl b/src/ejabberd_sql_sup.erl index 2251c811e..d4af0244b 100644 --- a/src/ejabberd_sql_sup.erl +++ b/src/ejabberd_sql_sup.erl @@ -188,7 +188,11 @@ check_sqlite_db(Host) -> create_sqlite_tables(DB) -> SqlDir = misc:sql_dir(), - File = filename:join(SqlDir, "lite.sql"), + Filename = case ejabberd_sql:use_new_schema() of + true -> "lite.new.sql"; + false -> "lite.sql" + end, + File = filename:join(SqlDir, Filename), case file:open(File, [read, binary]) of {ok, Fd} -> Qs = read_lines(Fd, File, []), |