Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Releases: alexisvisco/amigo

Package name configurable

31 Jan 09:22

Choose a tag to compare

Default to folder iof migrations and is now configurable

v0.0.15-alpha

16 Jan 21:45

Choose a tag to compare

Breaking Change Fix: PostgreSQL Dollar-Quoted Functions

Previously, SQL migrations were always split by semicolons, which broke PostgreSQL functions using dollar-quoted strings ($$...$$). This release fixes the issue by disabling statement splitting by default.


What Changed

Behavior Before After
Default Always split by ; Single exec (no splitting)
PostgreSQL/SQLite Broke $$ strings Works correctly
ClickHouse Worked Requires SplitStatements: true

New Configuration Option

Option Type Default Description
SplitStatements bool false When false, entire migration sent as single exec. When true, splits by semicolons respecting annotations.

Example:

config := amigo.Configuration{
    SplitStatements: true,  // Enable for ClickHouse
}

Annotation Reference

Annotation Purpose
-- amigo:statement:begin Start a protected block (no splitting inside)
-- amigo:statement:end End a protected block

Examples

PostgreSQL Functions (Now Works by Default)

-- migrate:up
CREATE OR REPLACE FUNCTION uuid_generate_v7()
RETURNS uuid AS $$
BEGIN
  -- Internal semicolons no longer break the migration
  SELECT 1;
  SELECT 2;
  RETURN gen_random_uuid();
END;
$$ LANGUAGE plpgsql;

-- migrate:down
DROP FUNCTION IF EXISTS uuid_generate_v7();

ClickHouse with Protected Blocks

For ClickHouse users who need statement splitting, enable it and use annotations to protect complex statements:

config := amigo.Configuration{
    SplitStatements: true,  // Required for ClickHouse
}
-- migrate:up
CREATE TABLE foo (id UInt64) ENGINE = MergeTree();

-- amigo:statement:begin
CREATE FUNCTION myFunc AS (x) -> multiIf(
    x = 1, 'one;',
    x = 2, 'two;',
    'other'
);
-- amigo:statement:end

CREATE TABLE bar (id UInt64) ENGINE = MergeTree();

-- migrate:down
DROP TABLE bar;
DROP FUNCTION myFunc;
DROP TABLE foo;

Migration Guide

Database Action Required
PostgreSQL None - works by default
SQLite None - works by default
ClickHouse Add SplitStatements: true to configuration

v0.0.14-alpha

25 Dec 10:32

Choose a tag to compare

Remove active record like thing, focus on migration in go and sql, with multi database support and no extra dependencies.

v0.0.13-alpha release

29 Nov 18:56

Choose a tag to compare

Breaking change :

  • better consistency, use main.go generated for the whole cli
  • better support for unsuported drivers
  • change config to contexts.yml, better support for multiple db with the cli

v0.0.12-alpha

08 Nov 10:22

Choose a tag to compare

BREAKING CHANGE: migrations are now in db/migrations.

  • better logging support
  • possibility to migrate using schema.sql (for fresh installs)
  • dump the schema via amigo schema
  • dump the schema via migrate/rollback cmd (-d flag)
  • update documentation

v0.0.11-alpha

05 Nov 09:00

Choose a tag to compare

  • BREAKING CHANGE: default amigo folder is now inside migrations/db
  • feature: Query with auto closing of rows

v0.0.10-alpha

31 Oct 12:37

Choose a tag to compare

refactor: better errors

v0.0.9-alpha

31 Oct 09:59

Choose a tag to compare

BREAKING CHANGE: changing the id column to version in the table mig_schema_migrations

v0.0.8-alpha

31 Oct 08:59

Choose a tag to compare

feature: add raw sql support

v0.0.7-alpha

30 May 07:03

Choose a tag to compare

  • support unknown dsn