Comments (8)
I consider, add shards.override.yml same as change shards.yml directly, right?
No, these are not the same. https://crystal-lang.org/reference/1.12/man/shards/index.html#fixing-dependency-version-conflicts
Using the shard override file is the proper way to handle this. Even Avram uses it https://github.com/luckyframework/avram/blob/main/shard.override.yml 😄
from avram.
This doesn't look like a bug. You created your column in the migration as Float
add number : Float64, precision: 10, scale: 5
Then in your model, you said it was Float | Nil
column number : Float64?
All Float
columns are stored as PG::Numeric
in the database, so it's trying to convert your PG::Numeric
to Float | Nil
as your model has, but the type should be Float
.
from avram.
Hi, same issue when change the column type to Float64?
require "pg"
require "avram"
class AppDatabase < Avram::Database
end
AppDatabase.configure do |settings|
settings.credentials = Avram::Credentials.new(database: "test_db", username: "postgres", hostname: "localhost")
end
Avram.configure do |settings|
settings.database_to_migrate = AppDatabase
settings.lazy_load_enabled = true
end
class CreateFoo::V20240420041991 < Avram::Migrator::Migration::V1
def migrate
create table_for(Foo), if_not_exists: true do
primary_key id : Int64
add number : Float64?, precision: 10, scale: 5
add_timestamps
end
end
def rollback
drop table_for(Foo)
end
end
Avram::Migrator::Runner.drop_db(true)
Avram::Migrator::Runner.create_db(true)
Avram::Migrator::Runner.new.run_next_migration
abstract class BaseModel < Avram::Model
def self.database : Avram::Database.class
AppDatabase
end
end
class Foo < BaseModel
table do
column number : Float64?
end
end
Foo::SaveOperation.create!(number: 70884.70074)
Foo::SaveOperation.create!(number: 50530.49889)
Foo::SaveOperation.create!(number: 37639.3706)
Foo::SaveOperation.create!(number: 18688.18317)
Foo::SaveOperation.create!(number: 18688.18317)
Foo::SaveOperation.create!
query = Foo::BaseQuery.new
query.number.select_min
from avram.
Hi, how to the newest changes on main branch in a exists lucky project?
Following is my shards.yml
---
name: college
version: 0.1.0
targets:
college:
main: src/college.cr
crystal: '>= 1.12.1'
dependencies:
lucky:
github: luckyframework/lucky
version: ~> 1.2.0
avram:
github: luckyframework/avram
version: ~> 1.2.0
carbon:
github: luckyframework/carbon
version: ~> 0.5.1
carbon_sendgrid_adapter:
github: luckyframework/carbon_sendgrid_adapter
version: ~> 0.5.0
lucky_env:
github: luckyframework/lucky_env
version: ~> 0.2.0
lucky_task:
github: luckyframework/lucky_task
version: ~> 0.3.0
authentic:
github: luckyframework/authentic
version: '>= 1.0.0, < 2.0.0'
jwt:
github: crystal-community/jwt
version: ~> 1.6.0
baked_file_system_mounter:
github: crystal-china/baked_file_system_mounter
development_dependencies:
lucky_flow:
github: luckyframework/lucky_flow
version: ~> 0.10.0
I get error like this when i run shards update
.
╰─ $ shards update
Resolving dependencies
Fetching https://github.com/luckyframework/lucky.git
Fetching https://github.com/luckyframework/avram.git
Fetching https://github.com/luckyframework/carbon_sendgrid_adapter.git
Fetching https://github.com/luckyframework/carbon.git
Fetching https://github.com/luckyframework/lucky_env.git
Fetching https://github.com/luckyframework/lucky_task.git
Fetching https://github.com/luckyframework/authentic.git
Fetching https://github.com/crystal-community/jwt.git
Fetching https://github.com/crystal-china/baked_file_system_mounter.git
Fetching https://github.com/luckyframework/lucky_flow.git
Unable to satisfy the following requirements:
- `avram (branch main)` required by `shard.yml`
- `avram (>= 1.0.0)` required by `authentic 1.0.0`
Failed to resolve dependencies
from avram.
@zw963 You need to create a new shards.override.yml
file with
dependencies:
avram:
github: luckyframework/avram
branch: main
from avram.
@zw963 You need to create a new
shards.override.yml
file withdependencies: avram: github: luckyframework/avram branch: main
Sorry, i paste the wrong file, following is my shards.yml, it not work.
---
name: college
version: 0.1.0
targets:
college:
main: src/college.cr
crystal: '>= 1.12.1'
dependencies:
lucky:
github: luckyframework/lucky
version: ~> 1.2.0
avram:
github: luckyframework/avram
branch: main
carbon:
github: luckyframework/carbon
version: ~> 0.5.1
carbon_sendgrid_adapter:
github: luckyframework/carbon_sendgrid_adapter
version: ~> 0.5.0
lucky_env:
github: luckyframework/lucky_env
version: ~> 0.2.0
lucky_task:
github: luckyframework/lucky_task
version: ~> 0.3.0
authentic:
github: luckyframework/authentic
version: '>= 1.0.0, < 2.0.0'
jwt:
github: crystal-community/jwt
version: ~> 1.6.1
baked_file_system_mounter:
github: crystal-china/baked_file_system_mounter
development_dependencies:
lucky_flow:
github: luckyframework/lucky_flow
version: ~> 0.10.0
the diff is:
diff --git a/shard.yml b/shard.yml
index 7735200..208b9bf 100644
--- a/shard.yml
+++ b/shard.yml
@@ -11,7 +11,7 @@ dependencies:
version: ~> 1.2.0
avram:
github: luckyframework/avram
- version: ~> 1.2.0
+ branch: main
carbon:
github: luckyframework/carbon
version: ~> 0.5.1
@@ -29,7 +29,7 @@ dependencies:
version: '>= 1.0.0, < 2.0.0'
jwt:
github: crystal-community/jwt
- version: ~> 1.6.0
+ version: ~> 1.6.1
baked_file_system_mounter:
github: crystal-china/baked_file_system_mounter
development_dependencies:
Get same error as above.
I consider, add shards.override.yml
same as change shards.yml
directly, right?
from avram.
If remove authentic
shards, update to use main branch of avram work.
diff --git a/shard.lock b/shard.lock
index 4065909..961005a 100644
--- a/shard.lock
+++ b/shard.lock
@@ -1,12 +1,8 @@
version: 2.0
shards:
- authentic:
- git: https://github.com/luckyframework/authentic.git
- version: 1.0.0
-
avram:
git: https://github.com/luckyframework/avram.git
- version: 1.2.0
+ version: 1.2.0+git.commit.1326a8ea7583b91169993194802bb0875172a9c3
backtracer:
git: https://github.com/sija/backtracer.cr.git
from avram.
Confirm the main branch fix my issue.
Thanks.
BTW: above override file name typo, it should be shard.override.yml
from avram.
Related Issues (20)
- Support use a self-defined index type when run create_index in migration.
- Add && array criteria method HOT 1
- Can't pass an array literal in to raw WHERE HOT 2
- [Bug] if compile error when running lucky db.migrate.one, the migration status get migrated unexpectly. HOT 4
- [Improvement] Better usage when use `make_required` `make_optional` and `remove` on the migration.
- Avram where OR with AND, not handle the priority correct? HOT 1
- Polymorphic preloads don't work the same as other ones
- Sub-associations from polymorphic types don't work
- Add if_exists option to drop table HOT 1
- [Migration] Change column type use `change_type` not change the optional of column? HOT 5
- [Feature] bin/lucky.gen.migration name support underscore form.
- Support write LEFT JOIN which include more than one condition use AND? HOT 7
- Run delete operation in a transaction HOT 1
- Fix inline docs on change_default
- allow_nulls_for and forbid_nulls are duplicated methods
- Use `postgres` as the default DB you connect to for db.create and db.drop tasks HOT 1
- Add `#have_error` spec expectation HOT 1
- Allow String keys to be set for error messages
- Stop using Symbols
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avram.