taguniversalmachine

taguniversalmachine

Hi

I am working through the Pragmatic Programmer “Programming Phoenix LiveView” book, and in the code generation section we run the phx.gen.auth generator, but when I run the tests I get:

12:37:30.010 [info] extension “citext” already exists, skipping
** (Postgrex.Error) ERROR 42P07 (duplicate_table) relation “users” already exists
(ecto_sql 3.7.2) lib/ecto/adapters/sql.ex:760: Ecto.Adapters.SQL.raise_sql_call_error/1
(elixir 1.12.1) lib/enum.ex:1553: Enum.“-map/2-lists^map/1-0-”/2
(ecto_sql 3.7.2) lib/ecto/adapters/sql.ex:852: Ecto.Adapters.SQL.execute_ddl/4
(ecto_sql 3.7.2) lib/ecto/migration/runner.ex:343: Ecto.Migration.Runner.log_and_execute_ddl/3
(ecto_sql 3.7.2) lib/ecto/migration/runner.ex:117: anonymous fn/6 in Ecto.Migration.Runner.flush/0
(elixir 1.12.1) lib/enum.ex:2356: Enum.“-reduce/3-lists^foldl/2-0-”/3
(ecto_sql 3.7.2) lib/ecto/migration/runner.ex:116: Ecto.Migration.Runner.flush/0
(ecto_sql 3.7.2) lib/ecto/migration/runner.ex:280: Ecto.Migration.Runner.perform_operation/3

I can run mix ecto.reset

% mix ecto.reset
The database for Pento.Repo has been dropped
The database for Pento.Repo has been created

13:39:18.491 [info] == Running 20220209071806 Pento.Repo.Migrations.CreateUsersAuthTables.change/0 forward

13:39:18.501 [info] execute “CREATE EXTENSION IF NOT EXISTS citext”

13:39:18.631 [info] create table users

13:39:18.669 [info] create index users_email_index

13:39:18.671 [info] create table users_tokens

13:39:18.679 [info] create index users_tokens_user_id_index

13:39:18.680 [info] create index users_tokens_context_token_index

13:39:18.733 [info] == Migrated 20220209071806 in 0.2s

but the test fails with the same error. I’m not sure how to diagnose this as everything is pretty much generated code. Any ideas?

Showing Posts 1 to 2

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

If you’re getting the error with tests, you should drop the test database and then try again:

MIX_ENV=test mix ecto.drop
mix test
taguniversalmachine

taguniversalmachine OP

well ok, that was awesome, thank you!

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews