CONTRIBUTING

Contributing

Thanks for your interest in ORM::ActiveRecord. This guide covers how to get set up, run the tests, and match the conventions the codebase already follows.

Getting set up

Install the dependencies:

zef install --deps-only .

The tests run against PostgreSQL, MySQL, and SQLite. SQLite needs no setup. For PostgreSQL and MySQL, create the databases and point the test environment at them in config/application.json (see Adapters for the config shape). You can also override the primary connection with DATABASE_URL.

Create and migrate the configured databases:

raku -Ilib bin/active-record createdb
raku -Ilib bin/active-record migrate

Running the tests

test.raku is the entry point. It runs the t/ suite (via prove6) and the specs/ suite (via behave).

A bare ./test.raku runs only the adapter named in config/application.json (the test.primary.adapter key), at the worker count from test.parallel. It does not probe the other two adapters. To run more than one adapter, name them explicitly with --adapter:

./test.raku                            # only the configured adapter (test.primary.adapter)
./test.raku --adapter=pg,mysql,sqlite  # all three, probing each
./test.raku --adapter=sqlite           # one specific adapter
./test.raku --prove6                   # only the t/ suite
./test.raku --behave                   # only the specs/ suite
./test.raku --all                      # once per config/application.json-*-example

When --adapter names an adapter your config does not define, that adapter falls back to its default connection URL (or its AR_*_URL env var), not to your config, so it may skip if unreachable. --all ignores config/application.json entirely: it swaps each config/application.json-*-example into place in turn, backing up and restoring your real config around the run.

Run a single file while iterating:

prove6 -Ilib t/validation/length.rakutest
behave specs/validation/length-spec.raku

After editing a library module, clear stale precompilation if behave's bulk discovery starts failing:

rm -rf lib/.precomp

Conventions

t/ and specs/ mirror each other

Every test in t/ (Test / prove6) has a counterpart in specs/ (BDD::Behave), and vice versa. Shared setup code lives under specs/lib/. When you change behaviour, update both sides in the same commit.

Register new modules in META6.json

When you add a lib/**/*.rakumod, add it to the provides section in the same step. prove6 -Ilib resolves by path and won't catch a missing entry, but zef and the metadata test will.

Migrations

Migration files are db/migrate/NNN-kebab-name.raku with a zero-padded numeric prefix. Generated migrations use a timestamp prefix instead. Avoid MySQL reserved words in table and column names — the DDL emitter does not quote identifiers.

Documentation

User-facing docs live under docs-src/docs/ and are wired into docs-src/mkdocs.yml. When a change adds a feature or changes behaviour, update the matching page in the same commit; the docs should track the specs/.

Code style

  • Separate logical chunks with blank lines.

  • Use descriptive names, even in small scopes.

  • Keep comments short and factual; prefer a test over a comment.

  • Method names cannot end in ! or ?: port save! to save-bang and valid? to is-valid. Underscores become hyphens.

Submitting changes

  1. Branch from main.

  2. Make your change with tests on both the t/ and specs/ sides.

  3. Run ./test.raku and make sure it passes.

  4. Update the docs and CHANGELOG.md under [Unreleased].

  5. Open a pull request describing the change and why.

Reporting issues

Open an issue with the adapter and version, a minimal model and migration that reproduces the problem, and the SQL or error you see (set DISABLE-SQL-LOG unset to view the SQL).

ORM::ActiveRecord v0.9.2

Object-relational mapping module

Authors

  • Greg Donald

License

Artistic-2.0

Dependencies

DBIishJSON::TinyLog::AsyncYAMLishOpenSSLBase64

Provides

  • ORM::ActiveRecord::Adapter
  • ORM::ActiveRecord::Adapter::MySql
  • ORM::ActiveRecord::Adapter::Pg
  • ORM::ActiveRecord::Adapter::Sql
  • ORM::ActiveRecord::Adapter::Sql::AdvisoryLocks
  • ORM::ActiveRecord::Adapter::Sql::Aggregates
  • ORM::ActiveRecord::Adapter::Sql::Builders
  • ORM::ActiveRecord::Adapter::Sql::Ddl
  • ORM::ActiveRecord::Adapter::Sql::Exec
  • ORM::ActiveRecord::Adapter::Sql::Guards
  • ORM::ActiveRecord::Adapter::Sql::Transactions
  • ORM::ActiveRecord::Adapter::Sqlite
  • ORM::ActiveRecord::Connection::Pool
  • ORM::ActiveRecord::Connection::Registry
  • ORM::ActiveRecord::Connection::Switching
  • ORM::ActiveRecord::DB
  • ORM::ActiveRecord::Errors::Error
  • ORM::ActiveRecord::Errors::Errors
  • ORM::ActiveRecord::Errors::X
  • ORM::ActiveRecord::Instrumentation::LogSubscriber
  • ORM::ActiveRecord::Instrumentation::Notifications
  • ORM::ActiveRecord::Instrumentation::QueryLogs
  • ORM::ActiveRecord::Model
  • ORM::ActiveRecord::Model::Attributes
  • ORM::ActiveRecord::Model::Bulk
  • ORM::ActiveRecord::Model::Callbacks
  • ORM::ActiveRecord::Model::Cloning
  • ORM::ActiveRecord::Model::DirtyTracking
  • ORM::ActiveRecord::Model::Discard
  • ORM::ActiveRecord::Model::Encryption
  • ORM::ActiveRecord::Model::Enum
  • ORM::ActiveRecord::Model::Finders
  • ORM::ActiveRecord::Model::Inheritance
  • ORM::ActiveRecord::Model::Normalization
  • ORM::ActiveRecord::Model::PrimaryKey
  • ORM::ActiveRecord::Model::RawSql
  • ORM::ActiveRecord::Model::Reflection
  • ORM::ActiveRecord::Model::Relations
  • ORM::ActiveRecord::Model::Secure
  • ORM::ActiveRecord::Model::Serialization
  • ORM::ActiveRecord::Model::StatePredicates
  • ORM::ActiveRecord::Model::StrictLoading
  • ORM::ActiveRecord::Model::Suppressor
  • ORM::ActiveRecord::Model::Typing
  • ORM::ActiveRecord::Relation::Collection
  • ORM::ActiveRecord::Relation::Query
  • ORM::ActiveRecord::Relation::Query::Aggregations
  • ORM::ActiveRecord::Relation::Query::Async
  • ORM::ActiveRecord::Relation::Query::Batching
  • ORM::ActiveRecord::Relation::Query::Bulk
  • ORM::ActiveRecord::Relation::Query::Conditions
  • ORM::ActiveRecord::Relation::Query::Finders
  • ORM::ActiveRecord::Relation::Query::Joins
  • ORM::ActiveRecord::Relation::Query::Json
  • ORM::ActiveRecord::Relation::Query::Like
  • ORM::ActiveRecord::Relation::Query::Modifiers
  • ORM::ActiveRecord::Relation::Query::Predicates
  • ORM::ActiveRecord::Relation::Query::Preloader
  • ORM::ActiveRecord::Relation::Query::Sql
  • ORM::ActiveRecord::Relation::Scope
  • ORM::ActiveRecord::Relation::Scopes
  • ORM::ActiveRecord::Schema::Cache
  • ORM::ActiveRecord::Schema::DbReady
  • ORM::ActiveRecord::Schema::DbTasks
  • ORM::ActiveRecord::Schema::Dumper
  • ORM::ActiveRecord::Schema::Field
  • ORM::ActiveRecord::Schema::Generator
  • ORM::ActiveRecord::Schema::Migrate
  • ORM::ActiveRecord::Schema::Migration
  • ORM::ActiveRecord::Schema::WorkerDbs
  • ORM::ActiveRecord::Support::Colors
  • ORM::ActiveRecord::Support::Crypto
  • ORM::ActiveRecord::Support::DatabaseUrl
  • ORM::ActiveRecord::Support::Environment
  • ORM::ActiveRecord::Support::I18n
  • ORM::ActiveRecord::Support::Log
  • ORM::ActiveRecord::Support::Message
  • ORM::ActiveRecord::Support::Runtime
  • ORM::ActiveRecord::Support::Secrets
  • ORM::ActiveRecord::Support::Spell
  • ORM::ActiveRecord::Support::TestSkip
  • ORM::ActiveRecord::Support::Utils
  • ORM::ActiveRecord::Support::Version
  • ORM::ActiveRecord::Support::WorkerDb
  • ORM::ActiveRecord::Testing::DatabaseCleaner
  • ORM::ActiveRecord::Testing::Fixtures
  • ORM::ActiveRecord::Testing::Transaction
  • ORM::ActiveRecord::Type
  • ORM::ActiveRecord::Type::Encrypted
  • ORM::ActiveRecord::Type::Yaml
  • ORM::ActiveRecord::Validations::Validator
  • ORM::ActiveRecord::Validations::Validators

Documentation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.