# Meridian 1.1.1.0 — installation

Inventory management with CRM features for Windows. This guide covers a clean
installation: the PostgreSQL server, the database, the program, the first
login, demo data and updates.

Russian version — [README.ru.md](https://new-imobile.com/download/meridian/README.ru.md).
Product page — https://new-imobile.com/en/meridian/

---

## 1. What to download

| File | What it is | Size |
|---|---|---|
| [Meridian-setup.msi](https://new-imobile.com/download/meridian/Meridian-setup.msi) | the program (Windows x64), installed on every workstation | ≈ 144 MB |
| [Meridian-db-kit.zip](https://new-imobile.com/download/meridian/Meridian-db-kit.zip) | database kit: deployment script, schema, content, demo data | ≈ 0.3 MB |

The order, in short:

```
   1. PostgreSQL 12+            installed separately, with its own installer
   2. Meridian database         db\install\deploy-db.ps1 from the database kit
   3. the program               Meridian-setup.msi  ← asks for the database and tests it
```

**The database comes before the program, not after.** The program's installer
asks for the database address and offers to test the connection; there is
nothing to test until the database exists.

---

## 2. Prerequisites

| | |
|---|---|
| Windows | x64, Windows 10 / 11 or Server 2016+ |
| Rights | administrator — the program installs into `Program Files` |
| PostgreSQL | **12 or newer** (16 recommended) on the server; the standard installer from postgresql.org |
| PowerShell | 7 (`pwsh`) on the machine that deploys the database — https://aka.ms/powershell |
| Network | the PostgreSQL port (5432 by default) reachable from the workstations |

**Why 12 specifically.** The loyalty card table has a generated column
(`GENERATED ALWAYS AS ... STORED`), which arrived in PostgreSQL 12. On older
versions the schema will not deploy at all.

**The database role must be called `imobile`.** That is not a setting: the
connection string is embedded in the program, and only the server address, port
and database name are configurable. The deployment script creates exactly that
role with the matching password — otherwise the program cannot connect.

---

## 3. Step 1: PostgreSQL

Install PostgreSQL on the server with the standard installer. Remember the
`postgres` user password — the next step needs it. If workstations connect over
the network, open port 5432 in the server firewall and allow the connections in
`pg_hba.conf` (a line like `host all all 192.168.1.0/24 scram-sha-256`), then
restart the service.

To check that the server is visible from a workstation:

```powershell
Test-NetConnection <server address> -Port 5432
```

---

## 4. Step 2: the database

Unpack `Meridian-db-kit.zip` into any folder. Inside:

```
db\install\deploy-db.ps1      deployment script
db\install\010_schema.sql     schema: tables, indexes, functions, triggers
db\install\020_content.sql    content: reference lists, settings, roles, calendar
db\demo\001_demo_data.sql     demo data (loaded with -WithDemo)
db\demo\001_demo_data_rollback.sql   its removal
README.txt
```

From a machine that has PowerShell 7 and access to the PostgreSQL server (the
server itself is the simplest):

```powershell
pwsh -File db\install\deploy-db.ps1 `
     -DbHost 192.168.1.10 -Port 5432 `
     -SuperUser postgres -SuperPassword <postgres password> `
     -Database crm_main `
     -AdminPassword <password for logging into the program>
```

The script creates the `imobile` role and the database, deploys the schema and
the content, and creates the `admin` user with the given password. It takes
seconds. At the end it prints the number of tables, reference values and users —
a quick sign that everything is in place.

The `-WithDemo` switch adds demonstration data — see section 7. Do not pass it
for a production installation; do pass it for a test stand: **without a price
list the sale screen does not open at all**.

**What runs the SQL.** The script looks for `psql.exe` in `PATH` and in
`C:\Program Files\PostgreSQL\<version>\bin` — every PostgreSQL installation has
it. If you deploy from a machine without PostgreSQL, point the script at psql
with `-Psql` (copying the `bin` folder from a PostgreSQL distribution is
enough) or run the script on the server.

**Re-running is safe**: the schema uses `IF NOT EXISTS` and `CREATE OR
REPLACE`, the content checks that a row is not there yet. The same way you can
add demo data to an already deployed database later.

The login password is asked for rather than defaulted: every installation has
its own salt, so the same hash never appears twice.

---

## 5. Step 3: the program

Run `Meridian-setup.msi` as administrator on every workstation. The installer
shows:

1. **Welcome.**
2. **Installation folder** — `C:\Program Files\Imobile\Meridian` by default.
3. **Database**:

   | Field | What it is | Default |
   |---|---|---|
   | Server | address or name of the PostgreSQL machine | `127.0.0.1` |
   | Port | PostgreSQL port | `5432` |
   | Database | the database deployed in step 2 | `crm_main` |

   The **"Test connection"** button reaches the server with the same service
   account the program itself will use, and answers with one of three things:

   | Answer | What it means | What to do |
   |---|---|---|
   | "Connection works" + employee count | server responds, right database, content in place | continue |
   | "Could not connect" + error text | server not visible, port closed, or the `imobile` role missing | check the address, the firewall and step 2 |
   | "The server responds, but this is not a Meridian database" | PostgreSQL is there, but this database has no employee table | point at another database or deploy it (step 2) |

   Against an unreachable address the window waits for the TCP timeout (about
   20 seconds) and does not respond meanwhile. That is not a hang.

4. **Confirmation and installation.**

The shortcut goes into the Start menu, under "Meridian". The program folder
receives `Meridian.exe`, the connection file `DBConnect.db` (created during
installation from the values you entered), the Russian resources `Lang\`, the
fonts `Fonts\` and the database tool `tools\MeridianDbTool.exe`.

### Silent installation

```
msiexec /i Meridian-setup.msi /qn DB_HOST=192.168.1.10 DB_NAME=crm_main DB_PORT=5432
```

With a log, for when something needs investigating:

```
msiexec /i Meridian-setup.msi /l*v %TEMP%\meridian-install.log
```

---

## 6. First login and verification

1. Start Meridian. The login window should appear immediately — if the
   connection settings window appears instead, `DBConnect.db` was not created
   (see section 10).
2. Log in as `admin` with the password from step 2.
3. Check that sections open: Warehouse → Warehouses, Job → Clients.
4. Create the other users in Settings → Administration.
5. The Russian interface appears on a Russian Windows locale. The language is
   switched from the window system menu (`Alt+Space` → "Language"), without a
   restart.

**Licence.** For the first 14 days after installation the program runs with
full access and no activation. After that it needs an account on the site
(https://new-imobile.com/account): the free 10-seat plan is switched on in
your account, and paid packs (25, 50, 100 seats) are activated there after
purchase. A seat is taken by an employee with a login, not by a device: when
the seats run out, no new employees can be created, existing ones keep working.

---

## 7. Demo data

An empty database looks like a broken program: the sale screen needs a price
list, and there is none — nothing to pick from. The demo data creates the
retail price list "Розница (демо)", six real auto parts (ATE, HELLA, VALEO,
VICTOR REINZ, BILSTEIN) with prices, stock for three of them in the "Основной"
warehouse, applicability, cross-references and a customer's car. That is enough
to walk through receipt, transfer, sale and the cash desk.

**Enable** — add the `-WithDemo` switch when deploying the database:

```powershell
pwsh -File db\install\deploy-db.ps1 -DbHost 192.168.1.10 `
     -SuperPassword <postgres password> -AdminPassword <login password> -WithDemo
```

The same can be done later on an already deployed database — repeat the same
command with `-WithDemo`: the script only adds what is missing and leaves the
rest alone.

**Remove** — run the rollback script against the database:

```powershell
$env:PGPASSWORD = 'aaddasd11111p'   # password of the imobile role
& "C:\Program Files\PostgreSQL\16\bin\psql.exe" -h 192.168.1.10 -U imobile -d crm_main `
      -v ON_ERROR_STOP=1 -f db\demo\001_demo_data_rollback.sql
```

The deletion is real, not soft. If a demo product has already been sold or
moved between warehouses, the deletion will fail on it — remove those documents
first.

Do not load demo data into a production database: it is for a test stand or a
first look.

---

## 8. Updates

At login the installed program asks the site
(`https://new-imobile.com/download/meridian/latest.json`) in a background
thread whether a newer version exists. While there is nothing to say — no
connection or the same version — it stays quiet. A new version is shown in the
**About** window (which also shows the installed version), with the **Update**
button next to it.

- The package is downloaded only on request (about 150 MB); automatic
  download is off by default and can be enabled in the settings if the network
  allows.
- The download is verified by size and SHA-256 before it becomes installable.
- Installation is a button: the program closes and starts the installer. You
  choose the moment.

The check address is changed with the `UPDATE_URL` setting (Settings) if
packages are served from your own server.

**Database when upgrading from 1.1.0.0.** The database schema changed in
1.1.1.0 (tables were renamed; the old names remain as views). The database kit
deploys a clean database only and does **not** upgrade a 1.1.0.0 database —
running `deploy-db.ps1` over it leaves the database half-converted. Migrating
an existing database is a separate procedure; contact us via
https://new-imobile.com/contact before updating such an installation.

---

## 9. Changing the database, upgrading, removing

**Another database after installation.** The connection settings window opens
from the login form; a second configuration can be added there if there is more
than one database. From an administrator console:

```
cd "C:\Program Files\Imobile\Meridian\tools"
MeridianDbTool.exe --test-db --server 192.168.1.10 --db crm_stage
MeridianDbTool.exe --make-dbconnect --path "..\DBConnect.db" ^
                   --caption "Meridian" --server 192.168.1.10 --db crm_stage --dbport 5432
```

**Manual upgrade** — run the new package over the old one: the previous
installation is removed automatically, the server address and database are
asked for again.

**Removing** — Apps & Features, or `msiexec /x Meridian-setup.msi`. **The
database is not touched** — the data stays on the server.

---

## 10. When something is wrong

**The connection settings window instead of the login form.** `DBConnect.db` was
not created. Check the installation log (`/l*v`, look for `MakeDbConnect`) and
run the `--make-dbconnect` command from section 9 by hand.

**"Could not connect" during the test.** In order: is the server reachable
(`Test-NetConnection <address> -Port 5432`), does PostgreSQL admit this machine
(`pg_hba.conf`), does the `imobile` role exist (step 2).

**"The server responds, but this is not a Meridian database".** The address is
right, the database is not. Usually this is `postgres` instead of `crm_main`, or
a partially deployed database.

**Database script: "neither pgq.exe nor psql.exe found".** PostgreSQL is not
installed on this machine. Run the script on the server or point it at
`psql.exe` with `-Psql`.

**Database script: "password authentication failed".** Wrong `postgres`
password (`-SuperPassword`), or `pg_hba.conf` does not admit this machine.

**The sale screen does not open.** The database has no price list. Create one
in the program or load the demo data (section 7).

**English interface on a Russian Windows.** Check the `Lang\` folder next to
`Meridian.exe`. The language can also be overridden in the registry:
`HKCU\Software\Meccanosoft\CRM\Language`.

**The "Access and roles" editor opens with an empty list of screens.**
`form_catalog.tsv` is missing next to the exe — reinstall the package.

Questions — https://new-imobile.com/contact
