25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Minor fixes for new_sql_schema support in SQLite (#3303)

This commit is contained in:
Badlop 2021-05-11 18:18:15 +02:00
parent 4fdebd296a
commit 160cd11c83
2 changed files with 9 additions and 2 deletions

View File

@ -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))

View File

@ -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, []),