Fix lite.sql and convert binary to integer

This commit is contained in:
Sergey Abramyan 2015-03-27 22:14:29 +03:00
parent 5ae01e8bb4
commit 15af88a09a
2 changed files with 8 additions and 6 deletions

View File

@ -75,7 +75,7 @@ CREATE INDEX i_sr_user_grp ON sr_user (grp);
CREATE TABLE spool ( CREATE TABLE spool (
username text NOT NULL, username text NOT NULL,
xml text NOT NULL, xml text NOT NULL,
seq SERIAL, seq INTEGER PRIMARY KEY AUTOINCREMENT,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
); );
@ -141,7 +141,7 @@ CREATE TABLE privacy_default_list (
CREATE TABLE privacy_list ( CREATE TABLE privacy_list (
username text NOT NULL, username text NOT NULL,
name text NOT NULL, name text NOT NULL,
id SERIAL UNIQUE, id INTEGER PRIMARY KEY AUTOINCREMENT,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
); );
@ -182,7 +182,7 @@ CREATE TABLE pubsub_node (
node text, node text,
parent text, parent text,
type text, type text,
nodeid SERIAL UNIQUE nodeid INTEGER PRIMARY KEY AUTOINCREMENT
); );
CREATE INDEX i_pubsub_node_parent ON pubsub_node (parent); CREATE INDEX i_pubsub_node_parent ON pubsub_node (parent);
CREATE UNIQUE INDEX i_pubsub_node_tuple ON pubsub_node (host, node); CREATE UNIQUE INDEX i_pubsub_node_tuple ON pubsub_node (host, node);
@ -205,7 +205,7 @@ CREATE TABLE pubsub_state (
jid text, jid text,
affiliation character(1), affiliation character(1),
subscriptions text, subscriptions text,
stateid SERIAL UNIQUE stateid INTEGER PRIMARY KEY AUTOINCREMENT
); );
CREATE INDEX i_pubsub_state_jid ON pubsub_state (jid); CREATE INDEX i_pubsub_state_jid ON pubsub_state (jid);
CREATE UNIQUE INDEX i_pubsub_state_tuple ON pubsub_state (nodeid, jid); CREATE UNIQUE INDEX i_pubsub_state_tuple ON pubsub_state (nodeid, jid);

View File

@ -940,8 +940,10 @@ ip_to_list(IP) ->
binary_to_atom(Bin) -> binary_to_atom(Bin) ->
erlang:binary_to_atom(Bin, utf8). erlang:binary_to_atom(Bin, utf8).
binary_to_integer(Bin) -> binary_to_integer(Bin) when is_binary(Bin) ->
list_to_integer(binary_to_list(Bin)). list_to_integer(binary_to_list(Bin));
binary_to_integer(Bin) when is_integer(Bin) ->
Bin.
binary_to_integer(Bin, Base) -> binary_to_integer(Bin, Base) ->
list_to_integer(binary_to_list(Bin), Base). list_to_integer(binary_to_list(Bin), Base).