Skip to content

Commit

Permalink
Table_exists: expect table name, not model name
Browse files Browse the repository at this point in the history
1. Make API compatible with PostgreSQL adapter
2. Make it working when called with schema_migrations
3. It generally makes more sense to work with SQL table names,
  models can be renamed or deleted which would break old migrations.
  • Loading branch information
skalee committed Nov 21, 2014
1 parent 58f975e commit 63f2d29
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/db_adapters/boss_db_adapter_mysql.erl
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ count(Pid, Type, Conditions) ->
{error, MysqlRes} ->
{error, mysql:get_result_reason(MysqlRes)}
end.

table_exists(Pid, Type) ->
TableName = boss_record_lib:database_table(Type),

table_exists(Pid, TableName) ->
Res = fetch(Pid, ["SELECT 1 FROM ", TableName," LIMIT 1"]),
case Res of
{updated, _} ->
Expand Down

0 comments on commit 63f2d29

Please sign in to comment.