From baee8756510901028fa0cf2a5685c906657db29d Mon Sep 17 00:00:00 2001 From: Rotem Tamir Date: Tue, 19 Dec 2023 16:44:33 +0200 Subject: [PATCH] doc/website/blog: v0.16 announcement (#2385) --- doc/website/blog/2023-12-19-atlas-v-0-16.mdx | 398 +++++++++++++++++++ 1 file changed, 398 insertions(+) create mode 100644 doc/website/blog/2023-12-19-atlas-v-0-16.mdx diff --git a/doc/website/blog/2023-12-19-atlas-v-0-16.mdx b/doc/website/blog/2023-12-19-atlas-v-0-16.mdx new file mode 100644 index 00000000000..6629f760358 --- /dev/null +++ b/doc/website/blog/2023-12-19-atlas-v-0-16.mdx @@ -0,0 +1,398 @@ +--- +title: "Announcing v0.16: ClickHouse support, Hibernate Provider, Baseline Schemas and more" +authors: rotemtam +tags: [clickhouse, hibernate, baseline, schema, release] +--- + +import InstallationInstructions from '../../md/components/_installation_instructions.mdx' + +Hi everyone, + +It's been a while since our last version announcement and today I'm happy to share with you +[v0.16](https://github.com/ariga/atlas/releases/tag/v0.16.0), which includes some +very exciting improvements for Atlas: + +* **ClickHouse Beta Program** - ClickHouse is a high-performance, columnar database optimized for analytics + and real-time query processing. Support for ClickHouse in Atlas has been one of the top requested features + by our community in the past year. Today, we are happy to announce the launch of our ClickHouse Beta Program + which you can sign up for today. See details below. +* **Hibernate Provider** - Atlas now supports loading the desired state of your database directly from your + Hibernate code. Hibernate developers can now join developers from the [GORM](/guides/orms/gorm), + [Sequelize](/guides/orms/sequelize), [TypeORM](/guides/orms/typeorm) and + more communities who can now use Atlas to manage their database schema. +* **Baseline Schemas** - In some cases, your migrations rely on certain database objects to exist apriori to + your application schema, for example extensions or legacy tables. Atlas now supports defining a baseline + schema which will be loaded before automatically planning and applying your migrations. +* **Proactive conflict detection** - Teams that have connected their project to Atlas Cloud will get a prompt + in the CLI if their migration directory is out of sync with the latest version in Atlas Cloud. This ensures that + new migration files are added in a sequential order, preventing unexpected behavior. +* **Mermaid Support** - Atlas now supports generating a [Mermaid](https://mermaid.js.org/) diagram + of your database schema. This is a great way to visualize your database schema and share it with your team. +* **Review Policies** - Users working with declarative migrations can now define "review policies" which + can define thresholds for which kinds of changes require human review and which can be auto-applied. +* **Postgres Sequences** - Another long awaited feature, Atlas now supports managing sequences in PostgreSQL. + +I know that's quite a list, so let's dive right in! + +### ClickHouse Beta Program + +[ClickHouse](https://clickhouse.com/) is a high-performance, columnar database optimized for analytics and real-time query processing. +Support for ClickHouse in Atlas has been one of the top requested features by our community in the past year. +Our team has been working hard to bring this feature to you and today we are happy to announce the launch of +our ClickHouse Beta Program. + +Here's what you need to do to get started: + +1. Log in to your [Atlas Cloud](https://atlasgo.cloud) account. If you don't have an account yet, you can + [sign up for free](https://atlasgo.cloud/signup). +2. From your Atlas Cloud dashboard, click on your profile picture at the bottom left corner of the screen + and select "Beta Program". In the pop up, select "ClickHouse" and click "Next". Fill the short application form and click "Submit". + ![](https://atlasgo.io/uploads/blog/v0.16/clickhouse-optin.png) +3. Download the latest version of the Atlas CLI: + +4. Log in to your Atlas Cloud account from the CLI: + ```bash + atlas login + ``` +5. Spin up a local ClickHouse instance: + ```bash + docker run -d --name clickhouse-sandbox -p 9000:9000 -d clickhouse/clickhouse-server:latest + ``` +5. Verify that you are able to connect to this instance: + ```bash + atlas schema inspect -u 'clickhouse://localhost:9000' + ``` + If everything is working correctly, you should see the following output: + ```text + schema "default" { + engine = Atomic + } + ``` +6. Create a new file named `schema.hcl` with the following content: + ```hcl + schema "default" { + engine = Atomic + } + + table "users" { + schema = schema.default + engine = MergeTree + column "id" { + type = UInt32 + } + column "name" { + type = String + } + column "created" { + type = DateTime + } + primary_key { + columns = [column.id] + } + } + ``` +7. Run the following command to apply the schema to your local ClickHouse instance: + ```bash + atlas schema apply -u 'clickhouse://:@localhost:9000' -f schema.hcl + ``` + Atlas will prompt you to confirm the changes: + ```text + -- Planned Changes: + -- Create "users" table + CREATE TABLE `default`.`users` ( + `id` UInt32, + `name` String, + `created` DateTime + ) ENGINE = MergeTree + PRIMARY KEY (`id`) SETTINGS index_granularity = 8192; + ``` + Hit "Enter" to apply the changes. +8. Amazing! Our schema has been applied to the database! + +### Hibernate Provider + +Atlas now supports loading the desired state of your database directly from your Hibernate code. +Packaged as both a Maven and Gradle plugin, the Hibernate provider allows you seamlessly integrate +Atlas into your existing Hibernate project. + +Hibernate ships with an automatic schema management tool called [`hbm2ddl`](https://docs.jboss.org/hibernate/orm/6.4/userguide/html_single/Hibernate_User_Guide.html#schema-generation). +Similarly to Atlas, this tool can inspect a target database and automatically migrate the schema to the desired one. +However, the Hibernate team has been advising for years **not** to use this tool in production: + +> Although the automatic schema generation is very useful for testing and prototyping purposes, + in a production environment, it’s much more flexible to manage the schema using incremental migration scripts. + +This is where Atlas comes in. Atlas can read Hibernate schema and plan database schema migrations. + +To get started, refer to the [blog post we published](2023-12-12-hibernate-schema-loader.mdx) earlier this week. + +### Baseline Schemas + +:::info LOGIN REQUIRED + +The `docker` block is available for logged-in users only. To use this feature, run: + +``` +atlas login +``` +::: + +In some cases, there is a need to configure a baseline schema for the dev database so that every computation using the +dev-database starts from this baseline. For example, users' schemas or migrations rely on objects, extensions, or +other schema resources that are not managed by the project. + +To configure such a baseline, use the `docker` block with the relevant image and pass to it the script for creating the +base schema for the project: + +```hcl +docker "postgres" "dev" { + image = "postgres:15" + schema = "public" + // highlight-start + baseline = <