Run doltgres. This will create a postgres user (with a password of password) and a postgres database in ~/doltgres/databases (add the --data-dir argument or change the DOLTGRES_DATA_DIR environment variable to use a different directory).
Make sure you have Postgres version 15 or higher installed. I used Homebrew to install Postgres on my Mac. This requires I manually add /opt/homebrew/opt/postgresql@15/bin to my path. On Postgres version 14 or lower, \ commands (i.e. \d, \l) do not yet work with Doltgres.
Open a new terminal. Connect with the following command: psql -h localhost -U postgres and enter the password password when prompted. This will connect to the postgres database with the postgres user.
$psql-h127.0.0.1-UpostgresPasswordforuserpostgres:psql (15.4 (Homebrew), server 15.0)Type"help"forhelp.postgres=>
Create a getting_started database. Create the getting_started example tables.
postgres=>createdatabase getting_started;--(0rows)postgres=> \c getting_started;psql (15.4 (Homebrew), server15.0)You are now connected todatabase"getting_started"as user "postgres".getting_started=>createtable employees ( id int8, last_name text, first_name text,primary key(id));--(0rows)getting_started=>createtable teams ( id int8, team_name text,primary key(id));--(0rows)getting_started=>createtable employees_teams( team_id int8, employee_id int8,primary key(team_id, employee_id),foreign key (team_id) references teams(id),foreign key (employee_id) references employees(id));--(0rows)getting_started=> \d List of relationsSchema | Name | Type | Owner--------+-----------------+-------+---------- public | employees | table | postgres public | employees_teams | table | postgres public | teams | table | postgres(3rows)
Make a Dolt Commit.
getting_started=>select*from dolt_status; table_name | staged | status------------------------+--------+----------- public.employees | 0 | new table public.employees_teams | 0 | new table public.teams | 0 | new table(3rows)getting_started=>select dolt_add('teams', 'employees', 'employees_teams');status--------0(1row)getting_started=>select*from dolt_status; table_name | staged | status------------------------+--------+----------- public.employees | 1 | new table public.employees_teams | 1 | new table public.teams | 1 | new table(3rows)getting_started=>select dolt_commit('-m', 'Created initial schema');hash---------------------------------- peqq98e2dl5gscvfvic71e7j6ne34533(1row)