Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

bug(migrations): quoted version_table renders invalid CREATE TABLE

クローズ 初心者向け
#815 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
84/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
postgresql, python, sql
領域
databases

調査の方向性

sqlspec/migrations/base.py の BaseMigrationTracker._split_version_table から始め、次に sqlspec/migrations/tracker.py の _tracking_table_builder と SyncMigrationTracker の例を確認します。引用符付きの App.Tracker 入力と postgres DDL で再現します。CREATE TABLE が二重化された引用符なしで "App"."Tracker" を使用し、tracker の他のステートメントも同じテーブルを使用すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

A quoted migration version_table name produces invalid CREATE TABLE SQL. The quotes around each part are kept, then quoted again when the DDL is rendered.

Reproduce

from sqlspec.migrations.tracker import SyncMigrationTracker

tracker = SyncMigrationTracker('"App"."Tracker"')
print(repr(tracker.version_table_name), repr(tracker.version_table_schema))
# '"Tracker"' '"App"'
print(tracker._tracking_table_ddl().build(dialect="postgres").sql.splitlines()[0])
# CREATE TABLE IF NOT EXISTS """App"""."""Tracker""" (

Expected

CREATE TABLE IF NOT EXISTS "App"."Tracker" (, with the tracker's other statements referring to the same table.

Cause

BaseMigrationTracker._split_version_table (sqlspec/migrations/base.py) splits on the dot but leaves the double quotes on each part. The DDL builder in _tracking_table_builder then treats the quotes as part of the name and escapes them. Any adapter that uses the generic tracker DDL is affected. To fix it, strip the quotes when splitting and keep a flag saying the name was quoted, so the table is still created with its exact case.

主要言語
Python
スター
104
フォーク
9
平均マージ
1日 4時間
マージ済み PR(30日)
44

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

litestar-org/sqlspec のほかの issue

litestar-org/sqlspec の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。