david on Nostr: These are the commands I used to set up indices and constraints - I had thought it ...
These are the commands I used to set up indices and constraints - I had thought it would be redundant to set up a constraint when it’s already indexed, but I saw some nodes get unexpectedly duplicated which is why I added the constraints
CREATE INDEX event_id IF NOT EXISTS FOR (a:ApocNostrEvent) ON (a.id)
CREATE INDEX pubkey IF NOT EXISTS FOR (a:ApocNostrUser) ON (a.id)
CREATE CONSTRAINT constraint_event_id FOR (event:ApocNostrEvent) REQUIRE event.event_id IS UNIQUE
CREATE CONSTRAINT constraint_pubkey FOR (user:ApocNostrUser) REQUIRE user.pubkey IS UNIQUE
CREATE INDEX event_id IF NOT EXISTS FOR (a:ApocNostrEvent) ON (a.id)
CREATE INDEX pubkey IF NOT EXISTS FOR (a:ApocNostrUser) ON (a.id)
CREATE CONSTRAINT constraint_event_id FOR (event:ApocNostrEvent) REQUIRE event.event_id IS UNIQUE
CREATE CONSTRAINT constraint_pubkey FOR (user:ApocNostrUser) REQUIRE user.pubkey IS UNIQUE