Comments (4)
I really think the better option is to use env()
to specify when you want to control a specific task.
# does not run migration
lucky dev
# runs migration
MIGRATE=true lucky dev
from avram.
Hi, i guess why this issue happen.
I added following code into my config/database.yml
if !LuckyEnv.task?
Avram::Migrator::Runner.new.run_pending_migrations
end
I thought it should never run when start server use lucky dev
, because i thought
lucky env is a task, right? but this not true obviously.
so, the migration file get migrate immediately when i generating it use bin/lucky.gen.migration ...
So, the new issue is, how to check current server is running from lucky dev
? i consider only check $LUCKY_DEV == development is not enough for my case, i just don't want lucky dev run my migration, but, it should be running if i run shards build
or lucky db.migrate.one
.
Thanks
from avram.
Maybe you can use a compile env
for this case?
# config/database.cr
{% if env("MIGRATE") %}
Avram::Migrator::Runner.new.run_pending_migrations
{% end %}
MIGRATE=true lucky db.migrate.one
from avram.
Maybe you can use a compile
env
for this case?# config/database.cr {% if env("MIGRATE") %} Avram::Migrator::Runner.new.run_pending_migrations {% end %}
MIGRATE=true lucky db.migrate.one
I consider this is not correct,, whatever whether env MIGRATE was set, db.migrate.one always run pending migration.
For now, i change to run pending migrate only in production
if !LuckyEnv.task? && LuckyEnv.production?
Avram::Migrator::Runner.new.run_pending_migrations
end
But, i still prefer to check if running with lucky dev
, anyway, i consider unless running with lucky dev
, other cases run migration automatically is always a good idea?
from avram.
Related Issues (20)
- Remove teeplate
- Move use of `puts` in Runner to IO management
- 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
- [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
- [Bug] Cast from PG::Numeric to (Float64 | Nil) failed. HOT 8
- [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
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.