Skip to content

Conversation

@sammyskills
Copy link
Contributor

According to the docs,

  • The method Forge::createTable() no longer executes a CREATE TABLE IF NOT EXISTS. If table is not found in $db->tableExists($table) then CREATE TABLE is executed.
  • The second parameter $ifNotExists of Forge::_createTable() is deprecated. It is no longer used and will be removed in a future release.

And since shield has been updated to ^4.2.3, I think this should be followed.

@sammyskills sammyskills changed the title Fix: removed deprecated second param in forge's createTable method Fix: removed deprecated second param in forge's createTable() method Aug 7, 2022
@kenjis kenjis added the refactor Pull requests that refactor code label Aug 8, 2022
Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in favor of this both due to the changes and for general practice. I don't like IF [NOT] EXISTS in migrations because I believe that if a migration conflict occurs then some other problem has happened and "hiding" it is a mistake.

But not everyone shares my opinion so let's see what others say.

@kenjis
Copy link
Member

kenjis commented Aug 9, 2022

The method Forge::createTable() no longer executes a CREATE TABLE IF NOT EXISTS. If table is not found in $db->tableExists($table) then CREATE TABLE is executed.

Ah, this may be misleading.

The method Forge::createTable() no longer executes a CREATE TABLE IF NOT EXISTS.

True.

If table is not found in $db->tableExists($table) then CREATE TABLE is executed.

This is when $ifNotExists is true.
When $ifNotExists is false (by default), CREATE TABLE is always executed.

The second param in Forge's createTable() method is NOT deprecated.

@kenjis kenjis changed the title Fix: removed deprecated second param in forge's createTable() method Change the second param in Forge's createTable() method Aug 9, 2022
@MGatner MGatner merged commit bc85d79 into codeigniter4:develop Aug 9, 2022
@MGatner
Copy link
Member

MGatner commented Aug 9, 2022

Thanks @sammyskills!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Pull requests that refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants