Complete win script setup

This commit is contained in:
Charles Bochet
2023-10-14 22:40:05 +02:00
parent fa9303f545
commit 986082d7a7
5 changed files with 20 additions and 24 deletions

View File

@ -6,6 +6,8 @@ sidebar_custom_props:
icon: TbFolder
---
# Folder Architecture
In this guide, you will explore the details of the project directory structure and how it contributes to the organization and maintainability of Twenty.
By following this folder architecture convention, it is easier to find the files related to specific features and ensure that the application is scalable and maintainable.

View File

@ -60,7 +60,7 @@ This database needs to be provisionned with the a `twenty` user (password: `twen
```bash
cd twenty
sh ./infra/dev/scripts/setup-database.sh
./infra/dev/scripts/setup-database.sh
```
<b>Option 2:</b> Alternatively if you have docker installed:
@ -89,7 +89,7 @@ You can access them using `twenty` postgres user (password: `twenty`)
We recommend to provision your database locally:
```bash
cd twenty
sh ./infra/dev/scripts/setup-database.sh
./infra/dev/scripts/setup-database.sh
```
This will create a Docker container, exposing a PostgresSQL instance at [http://localhost:5432](http://localhost:5432).
You can access them using `twenty` postgres user (password: `twenty`)

View File

@ -1,22 +1,10 @@
-- Create table "default" for local setup without docker
SELECT 'CREATE DATABASE "default"'
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'default')\gexec
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'default');
SELECT 'CREATE DATABASE "test"'
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'test');
-- Create user "twenty" for local setup without docker
SELECT 'CREATE USER twenty PASSWORD ''twenty'''
WHERE NOT EXISTS (SELECT FROM pg_user WHERE usename = 'twenty')\gexec
WHERE NOT EXISTS (SELECT FROM pg_user WHERE usename = 'twenty');
-- Inflect names for pg_graphql
COMMENT ON SCHEMA "public" IS '@graphql({"inflect_names": true})';
-- Connect to the "default" database
\c "default";
-- Create extension uuid-ossp
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- Create the tests database for e2e testing
CREATE DATABASE "test";
-- Connect to the "test" database for e2e testing
\c "test";
ALTER ROLE twenty superuser;

View File

@ -53,9 +53,9 @@ TARGETARCH=$(dpkg --print-architecture)
# Install PostgresSQL
echo_header $GREEN "Step [1/4]: Installing PostgreSQL..."
apt update -y || handle_error "Failed to update package list."
apt install -y postgresql-$PG_MAIN_VERSION postgresql-contrib || handle_error "Failed to install PostgreSQL."
apt install -y curl || handle_error "Failed to install curl."
sudo apt update -y || handle_error "Failed to update package list."
sudo apt install -y postgresql-$PG_MAIN_VERSION postgresql-contrib || handle_error "Failed to install PostgreSQL."su
sudo apt install -y curl || handle_error "Failed to install curl."
# Install pg_graphql extensions
echo_header $GREEN "Step [2/4]: Installing GraphQL for PostgreSQL..."
@ -73,4 +73,5 @@ fi
# Run the init.sql to setup database
echo_header $GREEN "Step [4/4]: Setting up database..."
sudo -u postgres psql -f ../postgres/init.sql || handle_error "Failed to execute init.sql script."
cp ./infra/dev/postgres/init.sql /tmp/init.sql
sudo -u postgres psql -f /tmp/init.sql || handle_error "Failed to execute init.sql script."

View File

@ -41,6 +41,11 @@ connectionSource
'create extension "uuid-ossp"',
);
await performQuery(
`COMMENT ON SCHEMA "public" IS '@graphql({"inflect_names": true})';`,
'inflect names for graphql',
);
await performQuery(
`
DROP FUNCTION IF EXISTS graphql;