From c9c74a3254862df90afd61e616086e28f2754aa2 Mon Sep 17 00:00:00 2001 From: define-null Date: Mon, 24 Oct 2022 20:09:12 +0200 Subject: [PATCH] Follow example structure with version directories (#57) --- .../migration_schemas/{1.sql => 1/postgres.sql} | 0 .../migration_schemas/{2.sql => 2/postgres.sql} | 0 lib/electric/migration_utils.ex | 12 +----------- 3 files changed, 1 insertion(+), 11 deletions(-) rename integration_tests/migrations/migration_schemas/{1.sql => 1/postgres.sql} (100%) rename integration_tests/migrations/migration_schemas/{2.sql => 2/postgres.sql} (100%) diff --git a/integration_tests/migrations/migration_schemas/1.sql b/integration_tests/migrations/migration_schemas/1/postgres.sql similarity index 100% rename from integration_tests/migrations/migration_schemas/1.sql rename to integration_tests/migrations/migration_schemas/1/postgres.sql diff --git a/integration_tests/migrations/migration_schemas/2.sql b/integration_tests/migrations/migration_schemas/2/postgres.sql similarity index 100% rename from integration_tests/migrations/migration_schemas/2.sql rename to integration_tests/migrations/migration_schemas/2/postgres.sql diff --git a/lib/electric/migration_utils.ex b/lib/electric/migration_utils.ex index 292303d2..8bf0264f 100644 --- a/lib/electric/migration_utils.ex +++ b/lib/electric/migration_utils.ex @@ -1,16 +1,6 @@ defmodule Electric.Migration.Utils do @type vsn() :: String.t() - @spec available_migrations() :: [vsn()] - def available_migrations() do - migration_path = get_migration_dir() - - Enum.map( - Path.wildcard(Path.join(migration_path, "*.sql")), - &Path.basename(&1, ".sql") - ) - end - @spec read_migration_file(vsn()) :: {:ok, binary} | {:error, term} def read_migration_file(vsn) do file = get_migration_path(vsn) @@ -27,7 +17,7 @@ defmodule Electric.Migration.Utils do @spec get_migration_path(vsn()) :: binary def get_migration_path(vsn) do migration_path = get_migration_dir() - Path.join(migration_path, vsn <> ".sql") + Path.join(migration_path, vsn <> "/postgres.sql") end defp get_migration_dir() do