mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Change README.md
This commit is contained in:
parent
a3ac360889
commit
fb353b8a68
@ -190,7 +190,7 @@ For Docker compose `up` or `build` commands, you can use our Apple M1 override f
|
||||
|
||||
# for development
|
||||
$ docker compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.apple-m1.override.yml up
|
||||
# only once: init admin user and create indexes and contraints in Neo4j database
|
||||
# only once: init admin user and create indices and constraints in Neo4j database
|
||||
$ docker compose exec backend yarn prod:migrate init
|
||||
# clean db
|
||||
$ docker compose exec backend yarn db:reset
|
||||
@ -199,7 +199,7 @@ $ docker compose exec backend yarn db:seed
|
||||
|
||||
# for production
|
||||
$ docker compose -f docker-compose.yml -f docker-compose.apple-m1.override.yml up
|
||||
# only once: init admin user and create indexes and contraints in Neo4j database
|
||||
# only once: init admin user and create indices and constraints in Neo4j database
|
||||
$ docker compose exec backend /bin/sh -c "yarn prod:migrate init"
|
||||
```
|
||||
|
||||
|
||||
@ -139,6 +139,7 @@ Prepare database once before you start by running the following command in a sec
|
||||
```bash
|
||||
# in main folder while docker-compose is up
|
||||
$ docker-compose exec backend yarn run db:migrate init
|
||||
$ docker-compose exec backend yarn run db:migrate up
|
||||
```
|
||||
|
||||
Then clear and seed database by running the following command as well in the second terminal:
|
||||
|
||||
@ -24,7 +24,7 @@ $ docker compose -f docker-compose.yml -f docker-compose.apple-m1.override.yml u
|
||||
# for production testing Docker images from DockerHub
|
||||
$ docker compose -f docker-compose.ocelotsocial-branded.yml -f docker-compose.apple-m1.override.yml up
|
||||
|
||||
# only once: init admin user and create indexes and contraints in Neo4j database
|
||||
# only once: init admin user and create indices and constraints in Neo4j database
|
||||
$ docker compose exec backend /bin/sh -c "yarn prod:migrate init"
|
||||
```
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ for development, spin up a
|
||||
[hosted Neo4j Sandbox instance](https://neo4j.com/download/), run Neo4j in one
|
||||
of the [many cloud options](https://neo4j.com/developer/guide-cloud-deployment/),
|
||||
[spin up Neo4j in a Docker container](https://neo4j.com/developer/docker/),
|
||||
on Archlinux you can install [neo4j-community from AUR](https://aur.archlinux.org/packages/neo4j-community/)
|
||||
on Arch linux you can install [neo4j-community from AUR](https://aur.archlinux.org/packages/neo4j-community/)
|
||||
or on Debian-based systems install [Neo4j from the Debian Repository](http://debian.neo4j.org/).
|
||||
Just be sure to update the Neo4j connection string and credentials accordingly
|
||||
in `backend/.env`.
|
||||
@ -55,15 +55,15 @@ Start Neo4J and confirm the database is running at [http://localhost:7474](http:
|
||||
|
||||
Here we describe some rarely used Cypher commands for Neo4j that are needed from time to time:
|
||||
|
||||
### Index And Contraint Commands
|
||||
### Index And Constraint Commands
|
||||
|
||||
If indexes or constraints are missing or not set correctly, the browser search will not work or the database seed for development will not work.
|
||||
If indices or constraints are missing or not set correctly, the browser search will not work or the database seed for development will not work.
|
||||
|
||||
The indexes and constraints of our database are set in `backend/src/db/migrate/store.js`.
|
||||
The indices and constraints of our database are set in `backend/src/db/migrate/store.js`.
|
||||
This is where the magic happens.
|
||||
|
||||
It's called by our `prod:migrate init` command.
|
||||
This command initializes the Admin user and creates all necessary indexes and constraints in the Neo4j database.
|
||||
This command initializes the Admin user and creates all necessary indices and constraints in the Neo4j database.
|
||||
|
||||
***Calls in development***
|
||||
|
||||
@ -98,27 +98,27 @@ On a server with Kubernetes cluster:
|
||||
$ kubectl -n default exec -it $(kubectl -n default get pods | grep ocelot-backend | awk '{ print $1 }') -- /bin/sh -c "yarn prod:migrate init"
|
||||
```
|
||||
|
||||
***Cypher commands to show indexes and constraints***
|
||||
***Cypher commands to show indices and constraints***
|
||||
|
||||
```bash
|
||||
# in browser command line or cypher shell
|
||||
|
||||
# show all indexes and constraints
|
||||
# show all indices and constraints
|
||||
$ :schema
|
||||
|
||||
# show all indexes
|
||||
# show all indices
|
||||
$ CALL db.indexes();
|
||||
|
||||
# show all constraints
|
||||
$ CALL db.constraints();
|
||||
```
|
||||
|
||||
***Cypher commands to create and drop indexes and constraints***
|
||||
***Cypher commands to create and drop indices and constraints***
|
||||
|
||||
```bash
|
||||
# in browser command line or cypher shell
|
||||
|
||||
# create indexes
|
||||
# create indices
|
||||
$ CALL db.index.fulltext.createNodeIndex("post_fulltext_search",["Post"],["title", "content"]);
|
||||
$ CALL db.index.fulltext.createNodeIndex("user_fulltext_search",["User"],["name", "slug"]);
|
||||
$ CALL db.index.fulltext.createNodeIndex("tag_fulltext_search",["Tag"],["id"]);
|
||||
@ -126,6 +126,6 @@ $ CALL db.index.fulltext.createNodeIndex("tag_fulltext_search",["Tag"],["id"]);
|
||||
# drop an index
|
||||
$ DROP CONSTRAINT ON ( image:Image ) ASSERT image.url IS UNIQUE
|
||||
|
||||
# drop all indexes and constraints
|
||||
# drop all indices and constraints
|
||||
$ CALL apoc.schema.assert({},{},true) YIELD label, key RETURN * ;
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user