#!/usr/bin/env elixir # Database Seeding Script for YSP Testing # Run this to populate the database with test terminal configurations # Add the project to the code path Code.append_path("_build/dev/lib/da_product_app/ebin") Code.append_path("_build/dev/lib/ecto/ebin") Code.append_path("_build/dev/lib/ecto_sql/ebin") Code.append_path("_build/dev/lib/myxql/ebin") Code.append_path("_build/dev/lib/decimal/ebin") Code.append_path("_build/dev/lib/jason/ebin") Code.append_path("_build/dev/lib/db_connection/ebin") # Start necessary applications Application.ensure_all_started(:crypto) Application.ensure_all_started(:ssl) Application.ensure_all_started(:myxql) Application.ensure_all_started(:ecto) Application.ensure_all_started(:ecto_sql) # Load the application Application.load(:da_product_app) # Configure the repo (same as config/dev.exs) Application.put_env(:da_product_app, DaProductApp.Repo, username: "root", password: "password", hostname: "localhost", database: "lic_project", stacktrace: true, show_sensitive_data_on_connection_error: true, pool_size: 10 ) # Start the repo {:ok, _} = DaProductApp.Repo.start_link() IO.puts("šŸ—„ļø Database connection established!") # Load and execute the test data seeding Code.require_file("priv/repo/seeds/test_data.exs") # Run the seeding DaProductApp.Seeds.TestData.seed_all() DaProductApp.Seeds.TestData.verify_seed_data() IO.puts("\nšŸŽ‰ Database seeding completed!") IO.puts("You can now test transactions with:") IO.puts(" • Terminal ID: 12345673") IO.puts(" • Merchant ID: 123456789012345") IO.puts(" • Additional terminals: 11111111, 22222222")