CREATE CONSTRAINT c1 IF NOT EXISTS FOR (c:Class) REQUIRE c.ID IS UNIQUE; CREATE CONSTRAINT c2 IF NOT EXISTS FOR (c:Class) REQUIRE c.NAME IS UNIQUE; CREATE CONSTRAINT c3 IF NOT EXISTS FOR (m:Method) REQUIRE m.ID IS UNIQUE; CREATE CONSTRAINT c4 IF NOT EXISTS FOR (m:Method) REQUIRE m.SIGNATURE IS UNIQUE; CREATE INDEX index1 IF NOT EXISTS FOR (m:Method) ON (m.NAME); CREATE INDEX index2 IF NOT EXISTS FOR (m:Method) ON (m.CLASSNAME); CREATE INDEX index3 IF NOT EXISTS FOR (m:Method) ON (m.NAME, m.CLASSNAME); CREATE INDEX index4 IF NOT EXISTS FOR (m:Method) ON (m.NAME, m.NAME0); CREATE INDEX index5 IF NOT EXISTS FOR (m:Method) ON (m.SIGNATURE); CREATE INDEX index6 IF NOT EXISTS FOR (m:Method) ON (m.NAME0); CREATE INDEX index7 IF NOT EXISTS FOR (m:Method) ON (m.NAME0, m.CLASSNAME); :schema //查看表库 :sysinfo //查看数据库信息
这是删除所有约束的语句,有需要可以使用
DROP CONSTRAINT c1; DROP CONSTRAINT c2; DROP CONSTRAINT c3; DROP CONSTRAINT c4; DROP INDEX index1; DROP INDEX index2; DROP INDEX index3; DROP INDEX index4; DROP INDEX index5; DROP INDEX index6; DROP INDEX index7;