-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
boss_migrate cannot handle "schema_migrations"? #198
Comments
After I went for pgsql, everything works. |
Why is this issue closed? This is not a fix for the MySql adapter. |
@adrianrosian is it something you are able to test? |
My colleague was able to reproduce this, I think he also said that he has a fix and will issue a pull request, I will keep you updated |
Sorry. By the way, the create_table/2 in adapter for pgsql only works with least expectations. |
What do you mean by 'least expectations'? |
As for create_table/2 in master () (1). only four types are supported column_type_to_sql(auto_increment) -> (2). column option, in effect, only [not_null] | [primary_key] are valid. ([not_null, primary_key] would generate sql "NOT NULLPRIMARY KEY" (sic)) column_options_to_sql(Options) -> That is all one can expect from create_table; it is enough for "schema_migrations" though. |
Oh, that, yes, it does the minimum necessary to handle migrations. Extending it would be cool, but is probably not really a priority right now. |
@davidw I saw that. Thank you. |
My problem was different:
The |
My problem with Mysql: > boss_migrate:run(address).
09:55:52.987 [info] Reading migration file: "/home/bunlong/workspace/my_project/geekhmerlab/chicagoboss/addressbook/priv/migrations/1420682718_address.erl"
** exception exit: {{undef,[{boss_db_adapter_mock,table_exists,
[undefined,schema_migrations],
[]},
{boss_db_controller,handle_call,3,
[{file,"src/boss_db_controller.erl"},{line,188}]},
{gen_server,try_handle_call,4,
[{file,"gen_server.erl"},{line,607}]},
{gen_server,handle_msg,5,
[{file,"gen_server.erl"},{line,639}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,237}]}]},
{gen_server,call,
[<0.293.0>,{table_exists,schema_migrations},30000]}}
in function gen_server:call/3 (gen_server.erl, line 190)
in call from boss_pool:call/3 (src/boss_pool.erl, line 12)
in call from boss_db:create_migration_table_if_needed/0 (src/boss_db.erl, line 122)
in call from boss_db:migrate/1 (src/boss_db.erl, line 108)
> 09:55:52.989 [error] gen_server <0.293.0> terminated with reason: call to undefined function boss_db_adapter_mock:table_exists/2 from boss_db_controller:handle_call/3 line 188
09:55:52.989 [error] CRASH REPORT Process <0.293.0> with 2 neighbours exited with reason: call to undefined function boss_db_adapter_mock:table_exists(undefined, schema_migrations) in gen_server:terminate/7 line 804
09:55:52.990 [error] Supervisor {<0.100.0>,poolboy_sup} had child boss_db_controller started with {boss_db_controller,start_link,undefined} at <0.293.0> exit with reason call to undefined function boss_db_adapter_mock:table_exists(undefined, schema_migrations) in context child_terminated Please help me to fix it. Thank you! |
Offhand, that doesn't look like Mysql... |
@davidw: So how can I fix it Sir? |
You should probably configure CB to use Mysql. Or, even better, use Postgres :-) |
@davidw: Yes I've already configured CB to use Mysql. I can connect to Mysql but I can't run migrate. :( |
hi
|
@Bunlong |
@liuzhen: I am a newbie with Chicagoboss, Could you details more than this? Thank you! |
I have the same error when using mysql. Setting up the schema_migrations table manually with like this does not help. CREATE TABLE `schema_migrations` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`version` text NOT NULL,
`migrated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
create model for it also 发自我的 iPhone
|
A model is not necessary |
Indeed, you should not create a model for that table. Someone is going to need to hack on the Mysql adapter and fix things up if it is not currently functional. The Postgres adapter is the one I originally added transactions to, so it's the one to use as a model. Or, you could always just use Postgres :-) |
It is already fixed in aforementioned #205. |
Hi, I was working with boss_db, when I found the db migration is left out from ChicagoBoss (CB), then I also add CB into rebar deps.
What I have done:
1 boss_migrate:make()
2 boss_migrate:run()
In the same erl, boss_db:execute() works well.
What did I do wrong?
boss_migrate:run(app_name_atom).
18:36:22.724 [info] Reading migration file: "/Path/priv/migrations/1413279116_create_table.erl"
** exception exit: {{undef,
[{schema_migrations,module_info,[exports],[]},
{boss_record_lib,dummy_record,1,
[{file,"src/boss_record_lib.erl"},{line,75}]},
{boss_record_lib,database_table,1,
[{file,"src/boss_record_lib.erl"},{line,99}]},
{boss_db_adapter_mysql,table_exists,2,
[{file,
"src/db_adapters/boss_db_adapter_mysql.erl"},
{line,105}]},
{boss_db_controller,handle_call,3,
[{file,"src/boss_db_controller.erl"},{line,192}]},
{gen_server,handle_msg,5,
[{file,"gen_server.erl"},{line,580}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,239}]}]},
The text was updated successfully, but these errors were encountered: