Postgres实际上没有datetime数据类型。两者都没有
AUTOINCREMENT
属性Django一定在向你展示这些,翻译PSTGRE
timestamp
到
datetime
和
SERIAL
.
附言
本身也不是数据类型。
t=# CREATE TABLE "myapp_event" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "start" datetime NOT NULL);
ERROR: syntax error at or near "AUTOINCREMENT"
LINE 1: ... "myapp_event" ("id" integer NOT NULL PRIMARY KEY AUTOINCREM...
^
t=# CREATE TABLE "myapp_event" ("id" SERIAL PRIMARY KEY, "start" datetime NOT NULL);
ERROR: type "datetime" does not exist
LINE 1: ...E "myapp_event" ("id" SERIAL PRIMARY KEY, "start" datetime N...
^
t=# CREATE TABLE "myapp_event" ("id" SERIAL PRIMARY KEY, "start" timestamp NOT NULL);
CREATE TABLE