# Platformatic v0.8.0 - autoload, composite keys, schemas, and many more

Hi Folks,

As you likely noticed, we are trying to keep a pace of one release per week on [platformatic](https://github.com/platformatic/platformatic).

The full release notes are available at: https://github.com/platformatic/platformatic/releases/tag/v0.8.0.

Here are the highlights of the release!

## `@fastify/autoload` support

<iframe width="640" height="366" src="https://www.loom.com/embed/88257de76ce044568c21632bfc779370"></iframe>

[`@fastify/autoload`](https://github.com/fastify/fastify-autoload) provides a convenient utility to load all [Fastify plugins](https://www.fastify.io/docs/latest/Reference/Plugins/) in a folder, automatically applying folder-based routing to all routes defined there.

This enables us to write the following configuration in `platformatic.service.yml` and `platformatic.db.yml`:

```plaintext
server:
  hostname: 0.0.0.0
  port: 3042
plugin:
  - './plugins'
  - './routes'
```

This enables us to automatically load files in directory structured like the following:

```plaintext
├── routes
│   ├── foo
│   │   ├── something.js
│   │   └── bar // all routes defined in this folder will have prefix /foo/bar
│   │       └── baz.js
│   ├── single-plugin
│   │   └── utils.js
│   └── another-plugin.js
└── platformatic.service.json
```

## Many-To-Many relationships

<iframe width="640" height="366" src="https://www.loom.com/embed/b8ff8ff4f7294b86b43eaf7d577bfb13"></iframe>

Many-to-Many relationship lets you relate each row in one table to many rows in another table and vice versa.

Many-to-many relationships are implemented in SQL via a "join table", a table whose **primary key** is composed by the identifier of the two parts of the many-to-many relationship.

Platformatic DB fully supports many-to-many relationships on all supported databases.

Consider the following schema:

```plaintext
CREATE TABLE pages (
  id INTEGER PRIMARY KEY,
  the_title VARCHAR(42)
);
CREATE TABLE users (
  id INTEGER PRIMARY KEY,
  username VARCHAR(255) NOT NULL
);
CREATE TABLE editors (
  page_id INTEGER NOT NULL,
  user_id INTEGER NOT NULL,
  role VARCHAR(255) NOT NULL,
  CONSTRAINT fk_editor_pages FOREIGN KEY (page_id) REFERENCES pages(id),
  CONSTRAINT fk_editor_users FOREIGN KEY (user_id) REFERENCES users(id),
  PRIMARY KEY (page_id, user_id)
);
```

```graphql
query {
  editors(orderBy: { field: role, direction: DESC }) {
    user {
      id
      username
    }
    page {
      id
      theTitle
    }
    role
  }
}
```

As well as routes:

* `GET /editors/user/1/page/1`
    
* `POST /editors/user/1/page/1`
    
* `PUT /editors/user/1/page/1`
    
* `DELETE /editors/user/1/page/1`
    

As well as the usual routes.

## Multiple Schemas

Added by [Marco Piraccini](https://github.com/marcelom97) in [#359](https://github.com/platformatic/platformatic/pull/359) and [#373](https://github.com/platformatic/platformatic/pull/373), it enables to use create OpenAPI and GraphQL APIs from multiple database schemas.

```json
  "core": {
    "connectionString": "(...)",
    "schema": [
      "schema1", "schema2"
    ],
    ... 
  },
```

Schemas must be specified in the configuration. These are then automatically set in the PostgreSQL `search path` for the connection (see [here](https://www.postgresql.org/docs/current/ddl-schemas.html#DDL-SCHEMAS-PATH) for more info).

## LIKE support

Added by [Marcelo Mollaj](https://github.com/marcelom97) in [#360](https://github.com/platformatic/platformatic/pull/360), this community contribution enables us to write queries like:

```plaintext
query {
  posts(where: { longText: { like: "%o%" } }) {
    id
    title
    longText
    counter
  }
}
```
