Skip to content

error generating migration #26

@kingshalaby1

Description

@kingshalaby1

Describe the bug
I got an error when I tried to generate a migration after I modified an existing resource attributes

MIX_ENV=test mix ash_postgres.generate_migrations --apis AshPostgres.Test.Api

I get this error:

** (SyntaxError) nofile:18: unexpected token: ":" (column 17, code point U+003A)
    (elixir 1.10.4) lib/code.ex:654: Code.format_string!/2
    lib/migration_generator/migration_generator.ex:332: AshPostgres.MigrationGenerator.write_migration/4
    (elixir 1.10.4) lib/enum.ex:789: anonymous fn/3 in Enum.each/2
    (stdlib 3.12.1) maps.erl:232: :maps.fold_1/3
    (elixir 1.10.4) lib/enum.ex:2127: Enum.each/2
    (mix 1.10.4) lib/mix/task.ex:330: Mix.Task.run_task/3
    (mix 1.10.4) lib/mix/cli.ex:82: Mix.CLI.run_task/2.

To Reproduce

  1. add a new attribute new_field to an existing resource Post in test/support/resources/posts.ex
  2. generate a migration using ash_postgres.generate_migrations task

Expected behavior
it should create a new migration file to alter table :posts, adding column :new_field correctly

** Runtime

  • Elixir 1.10.4
  • Erlang/OTP 22
  • Ash version 1.19
  • postgres (PostgreSQL) 12.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions