Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neo4j DB Migration: Twitter database #59

Open
amindadgar opened this issue Sep 26, 2023 · 2 comments
Open

Neo4j DB Migration: Twitter database #59

amindadgar opened this issue Sep 26, 2023 · 2 comments
Assignees

Comments

@amindadgar
Copy link
Member

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

  • 1st constraint:
CREATE CONSTRAINT user_id_unique IF NOT EXISTS
FOR (a:TwitterAccount) REQUIRE a.userId IS UNIQUE;
  • 2nd constraint
CREATE CONSTRAINT tweet_id_unique IF NOT EXISTS
FOR (t:Tweet) REQUIRE t.tweetId IS UNIQUE;
  • 3rd constraint
CREATE CONSTRAINT hashtag_unique IF NOT EXISTS
FOR (h:Hashtag) REQUIRE h.hashtag IS UNIQUE;
@amindadgar amindadgar self-assigned this Sep 26, 2023
@cyri113
Copy link
Contributor

cyri113 commented Sep 26, 2023

@amindadgar can you:

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

@amindadgar
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants