TogetherCrew / operations

This repository houses a collection of code artifacts, including Github actions, Github workflows, and essential docker-compose files. These resources are instrumental in facilitating efficient and automated staging and production deployments.
1 stars 0 forks source link

Neo4j DB Migration: Twitter database #59

Open amindadgar opened 11 months ago

amindadgar commented 11 months ago

In order to have the twitter neo4j database more consistent we need to define some rules in the database which we could have them using a database migration. Here's the queries for migration

cyri113 commented 11 months ago

@amindadgar can you:

1) generate a migration with them 2) share the neo4j migration commands with me

amindadgar commented 11 months ago

Here's the migration process explained in another issue in past: https://github.com/RnDAO/tc-DAOlytics/issues/226#issuecomment-1660371486

The migration file would be just to create a file named V001__twitter_rules_defining_migration.cypher (or any other names like it) the file should contain

CREATE CONSTRAINT user_id_unique IF NOT EXISTS
FOR (a:TwitterAccount) REQUIRE a.userId IS UNIQUE;
CREATE CONSTRAINT tweet_id_unique IF NOT EXISTS
FOR (t:Tweet) REQUIRE t.tweetId IS UNIQUE;
CREATE CONSTRAINT hashtag_unique IF NOT EXISTS
FOR (h:Hashtag) REQUIRE h.hashtag IS UNIQUE;

Note: If the discord and twitter neo4j databases are the same we have to call the file V002__twitter_rules_defining_migration.cypher, since we have the 001 version previously for defining the discord rules and constraints.