diff --git a/.gitignore b/.gitignore
index 9ac5afd3b..0347ef078 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
/lib/
/bin/ameba
/bin/ameba.cr
+/bin/ameba.exe
/bin/lucky.exec.cr
/bin/lucky.watch.cr
/bin/lucky.gen.action.cr
diff --git a/Dockerfile b/Dockerfile
index 1fdd649c6..be4d40e98 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM crystallang/crystal:1.10.0
+FROM crystallang/crystal:1.14.0
WORKDIR /data
# install base dependencies
@@ -12,7 +12,7 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Lucky cli
-RUN git clone https://github.com/luckyframework/lucky_cli --branch v1.1.0 --depth 1 /usr/local/lucky_cli && \
+RUN git clone https://github.com/luckyframework/lucky_cli --branch v1.3.0 --depth 1 /usr/local/lucky_cli && \
cd /usr/local/lucky_cli && \
shards install && \
crystal build src/lucky.cr -o /usr/local/bin/lucky
diff --git a/README.md b/README.md
index c05df137c..b7b6a66e6 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,8 @@
[![API Documentation Website](https://img.shields.io/website?down_color=red&down_message=Offline&label=API%20Documentation&up_message=Online&url=https%3A%2F%2Fluckyframework.github.io%2Favram%2F)](https://luckyframework.github.io/avram)
+Database ORM built for the [Lucky Framework](https://luckyframework.org/) written in Crystal. Supporting PostgreSQL 12+ and based off principals of [Elixir Ecto](https://hexdocs.pm/ecto/Ecto.html) and [Rails ActiveRecord](https://guides.rubyonrails.org/active_record_basics.html).
+
### Why Avram?
The name comes from [Henriette Avram](https://en.wikipedia.org/wiki/Henriette_Avram).
@@ -22,34 +24,73 @@ dependencies:
```crystal
require "avram"
+
+# Define your database
+class AppDatabase < Avram::Database
+end
+
+AppDatabase.configure do |settings|
+ settings.credentials = Avram::Credentials.new(
+ database: "my_app_development",
+ username: "postgres",
+ hostname: "localhost",
+ password: "password",
+ port: 5432,
+ )
+end
+
+# Configure Avram to use your database
+Avram.configure do |settings|
+ settings.database_to_migrate = AppDatabase
+
+ # When `true`, allow lazy loading (N+1).
+ # If `false` raise an error if you forget to preload associations
+ settings.lazy_load_enabled = true
+ settings.query_cache_enabled = false
+end
+
+# Create your read-only model
+class Person < Avram::Model
+ def self.database : Avram::Database.class
+ AppDatabase
+ end
+
+ table :people do
+ column name : String
+ column age : Int32
+ column programmer : Bool = true
+ end
+end
+
+# Insert a new record
+Person::SaveOperation.create!(name: "Henriette Davidson Avram", age: 86)
+# Query for a record
+person = Person::BaseQuery.new.name.ilike("%avram")
+person.programmer? #=> true
```
+For more details, read the [guides](https://luckyframework.org/guides/database/intro-to-avram-and-orms).
+
## Contributing
1. Fork it ( https://github.com/luckyframework/avram/fork )
1. Create your feature branch (git checkout -b my-new-feature)
-1. Install docker and docker-compose: https://docs.docker.com/compose/install/
-1. Run `script/setup`
1. Make your changes
-1. Run `script/test` to run the specs, build shards, and check formatting
+1. Run specs `crystal spec`
+1. Check formatting `crystal tool format spec/ src/`
+1. Check ameba `./bin/ameba`
1. Commit your changes (git commit -am 'Add some feature')
1. Push to the branch (git push origin my-new-feature)
1. Create a new Pull Request
-## Testing
-
-To run the tests:
+> Docker is provided for quick setup and testing. You can run `./script/setup` and `./script/test` for ease.
-1. Install docker and docker-compose: https://docs.docker.com/compose/install/
-1. Run `script/setup` to set up the docker environment
-1. Run `script/test` to run the specs, build shards, and check formatting
-
-You can run individual tests like this: `docker-compose run --rm app crystal spec path/to/spec.cr`
+## Contributors
-> Remember to run `docker-compose down` when you're done. This will stop the
-> Crystal container.
+[paulcsmith](https://github.com/paulcsmith) Paul Smith - Original Creator of Lucky
-## Contributors
+
+
+
-- [paulcsmith](https://github.com/paulcsmith) Paul Smith - creator, maintainer
-- [mikeeus](https://github.com/mikeeus) Mikias Abera - contributor
+Made with [contrib.rocks](https://contrib.rocks).
diff --git a/docker-compose.yml b/docker-compose.yml
index 29cf0a5c6..f801c2987 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -2,7 +2,7 @@ version: "3"
services:
db:
- image: postgres:14-alpine
+ image: postgres:16-alpine
environment:
POSTGRES_USER: lucky
POSTGRES_PASSWORD: developer
diff --git a/ssh.cr b/ssh.cr
deleted file mode 100644
index 90a410c5a..000000000
--- a/ssh.cr
+++ /dev/null
@@ -1,15 +0,0 @@
-def shell # (command)
- Process.run(
- "docker-compose",
- %w(run --rm app bash), # shell: true,
- # output: STDOUT,
- output: Process::Redirect::Pipe,
- error: STDERR
- ) do |process|
- process.output.gets_to_end
- end
-end
-
-# shell("docker-compose run --rm app bash")
-
-shell
diff --git a/up.yml b/up.yml
deleted file mode 100644
index dabda9b9b..000000000
--- a/up.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-# `up ` will default to running in this container
-#
-# For example, `up node index.js` will run `node index.js` in the `app` container
-# since it doesn't match any other up commands like `up stop` or `up install`
-main_container: app
-
-# You can customize the docker compose command here.
-#
-# Here's an example of how you might customize it:
-#
-# docker_compose_command: docker-compose -f docker-compose.dev.
-#
-# Note: for most projects the default is fine.
-docker_compose_command: docker-compose
-
-# Automatically rebuild images when these files have changed.
-#
-# Add files/directories your images rely on.
-rebuild_when_changed:
- - up.yml
- - Dockerfile
- - docker/*
- - docker-compose.*
- - shard.*
- - db/*