yiisoft / yiisoft/db-migration

SQLite does not support `addCommentOnTable()`

Open
#219 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
32
Forks
18
Avg merge
22h 18m
Merged PRs (30d)
2

Description

SQLite does not support addCommentOnTable() and addCommentOnColumn() but supports comments in CREATE TABLE query

CREATE TABLE `table_name` -- table comment
(
    id INTEGER, -- field comment
);

The follow command throws an Exception in SQLite

./yii migrate:create post --command=table --fields='name:string(50):comment("Student Name")'

Due to column comment is initialized separately

https://github.com/yiisoft/db-migration/blob/44f9ac4a33a69f8ac4154c51e8c9efd636ea4df8/src/MigrationBuilder.php#L199-L209

The same for the follow command

./yii migrate:create post --command=table --table-comment='Posts of blog'

https://github.com/yiisoft/db-migration/blob/940d9885aa17c273d7e3980f9730d220b6830658/resources/views/createTableMigration.php#L42-L53

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked sections of src/MigrationBuilder.php and resources/views/createTableMigration.php, then run the two provided yii migrate:create commands against SQLite. Check how table and column comments are generated and verify that the resulting migration uses SQLite-compatible CREATE TABLE comments without throwing an exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, sqlite
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.