我正在将 boss_db 用于一个小项目,并且遇到了一个我无法从文档中破译的问题。
这是我的 Postgres 数据库表:
CREATE TABLE recordings (
recording_id uuid PRIMARY KEY,
created timestamp NOT NULL,
cid_name text DEFAULT '',
cid_number text NOT NULL,
destination_number text NOT NULL,
file_path text NOT NULL,
message_len integer,
archived boolean DEFAULT false
);
这是我的模型文件:
-module(recording, [Id::uuid(),
Created::datetime(),
CidName::string(),
CidNumber::string(),
DestinationNumber::string(),
FilePath::string(),
MessageLen::integer(),
Archived::boolean()
]).
这是控制台上发生的事情:
1> myproto:start().
{ok,<0.34.0>}
2> {ok, recording} = boss_record_compiler:compile("recording.erl").
{ok,recording}
3> Recording = recording:new(id, {{2012, 12, 20}, {18, 19, 20}}, "", "1002", "1000", "/usr/local/freeswitch/encodings/2012-12-20-13-17-36_1000_1002.ogg", 260, false ).
{recording,id,
{{2012,12,20},{18,19,20}},
[],"1002","1000",
"/usr/local/freeswitch/encodings/2012-12-20-13-17-36_1000_1002.ogg",
260,false}
4> Recording:save().
{error,{error,error,<<"42703">>,
<<"column \"id\" of relation \"recordings\" does not exist">>,
[{position,<<"110">>}]}}