only maria107 maria102

exec mkdir migrations

! atlas migrate diff --to file://1.hcl --dir file://migrations
stderr '"dev-url" not set'

! atlas migrate diff --dev-url mysql://devdb --dir file://migrations
stderr '"to" not set'

atlas migrate diff --dev-url URL --to file://./1.hcl first
cmpmig 0 1.sql

atlas migrate diff --dev-url URL --to file://./2.hcl second
cmpmig 1 2.sql

# Clean migration directory and run diff with a custom qualifier.
exec rm -rf migrations
atlas migrate diff --dev-url URL --to file://./1.hcl --qualifier test first
cmpmig 0 1-qualifier.sql

-- 1.hcl --
schema "script_cli_migrate_diff" {}

table "users" {
  schema = schema.script_cli_migrate_diff
  column "id" {
    null = false
    type = bigint
    auto_increment = true
  }
  primary_key  {
    columns = [column.id]
  }
  charset = "utf8mb4"
  collate = "utf8mb4_general_ci"
}

-- 1.sql --
-- Create "users" table
CREATE TABLE `users` (`id` bigint NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`)) CHARSET utf8mb4 COLLATE utf8mb4_general_ci;

-- 1-qualifier.sql --
-- Create "users" table
CREATE TABLE `test`.`users` (`id` bigint NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`)) CHARSET utf8mb4 COLLATE utf8mb4_general_ci;

-- 2.hcl --
schema "script_cli_migrate_diff" {}

table "users" {
  schema = schema.script_cli_migrate_diff
  column "id" {
    null = false
    type = bigint
    auto_increment = true
  }
  column "create_time" {
    null    = false
    type    = timestamp(6)
    default = sql("CURRENT_TIMESTAMP(6)")
  }
  primary_key  {
    columns = [column.id]
  }
  charset = "utf8mb4"
  collate = "utf8mb4_general_ci"
}

-- 2.sql --
-- Modify "users" table
ALTER TABLE `users` ADD COLUMN `create_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6);

-- maria102/2.sql --
-- Modify "users" table
ALTER TABLE `users` ADD COLUMN `create_time` timestamp(6) NOT NULL DEFAULT (current_timestamp(6));

-- maria107/2.sql --
-- Modify "users" table
ALTER TABLE `users` ADD COLUMN `create_time` timestamp(6) NOT NULL DEFAULT (current_timestamp(6));
