-
Hello, i am working on a kemal + avram project which run on raspberry PI (ARM), i have to cross build the intermedia object file from my X86_64 laptop, and link it on PI to create the binary. this project simple enough anyway, but the issue is, i expect to run migration(if still not) automatically when i start my kemal web server which will load my db config before start. following is my db config: require "pg"
require "avram"
require "../models/base_model"
require "../models/**"
require "../queries/**"
require "../operations/**"
class AppDatabase < Avram::Database
end
AppDatabase.configure do |settings|
settings.credentials =
Avram::Credentials.parse?(ENV["DATABASE_URL"]?) ||
Avram::Credentials.new(
database: "#{app_name}_#{app_env}",
hostname: postgres_host,
port: postgres_port,
username: postgres_user,
password: postgres_password
)
end
Avram.configure do |settings|
settings.database_to_migrate = AppDatabase
settings.lazy_load_enabled = app_env != "production"
end I have two question here:
lucky db.create
You are not in a Lucky project
Try this...
▸ Run lucky init to create a Lucky project.
▸ Change your project's root directory to see what tasks are available.
i can use
Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
You can either make lucky_tasks a required dependency, then add a tasks.cr in your app root like a Lucky project would do, or you can run the migrations from code with Avram::Migrator::Runner.new.run_pending_migrations That will always try to run migrations. You may need to require your migration directory as well. |
Beta Was this translation helpful? Give feedback.
You can either make lucky_tasks a required dependency, then add a tasks.cr in your app root like a Lucky project would do, or you can run the migrations from code with
Avram::Migrator::Runner.new.run_pending_migrations
That will always try to run migrations. You may need to require your migration directory as well.