Skip to content
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

schema manager #1

Merged
merged 17 commits into from
Mar 13, 2024
Merged

schema manager #1

merged 17 commits into from
Mar 13, 2024

Conversation

pounard
Copy link
Member

@pounard pounard commented Feb 27, 2024

The plan

  • First, this is going to add a schema read API, for introspecting schema.
  • Then, and API for altering it.
  • Third, normalizing reading and writing to be ISO, and able to diff.
  • Maybe a visitor pattern for users, to do whatever they want to do with it, for navigating through the schema as a graph.

What's working

  • Full MySQL support ✔️
  • Full MariaDB support ✔️
  • Full PostgreSQL support ✔️
  • Partial SQLite support 🐗

What's missing

  • SQLServer support (I have a 6.7 linux kernel, and SQL Server crashes with it)
  • SQLite constraints ADD, DROP and ALTER, because they require
  • Allow arbitrary SQL queries during schema transaction, lets say ->query(fn (QueryBuilder): void), which does not directly executes the SQL but stacks it into the change log (after all, schema transactions are basically upgrade procedures, and the user probably wants to be able to add data alteration along the way) Done it !
  • ALTER TABLE x MODIFY COLUMN y OK done it!
  • ALTER CONSTRAINT x RENAME TO y
  • Reading indexes
  • Reading ISO to what we are able to write
  • More tests
  • AaAAAAAahhhh COLLATIONS !!! Terrible thing to handle... Some SQL vendors don't want to you to read column collation, some others have terrible names, some other are so dynamic that from one container image to another collation names are not the same...
  • Better column default values handling
  • A method for not sending queries on transaction apply, but a dry-run result instead.
  • Logging !

Future plans

  • Types normalization, for identifying sequences, serials, identity, etc...
  • Ability for read the schema, then recreate it identically from the definition, required for:
    • Emulation of ADD / DROP / RENAME in SQLite
    • Schema diff

@pounard pounard added the enhancement New feature or request label Feb 27, 2024
@pounard pounard self-assigned this Feb 27, 2024
@pounard pounard force-pushed the no-issue-schema-manager branch 13 times, most recently from fda8210 to 448576f Compare March 1, 2024 11:44
docs/content/query/schema.md Outdated Show resolved Hide resolved
docs/content/query/schema.md Outdated Show resolved Hide resolved
docs/content/query/schema.md Outdated Show resolved Hide resolved
docs/content/query/schema.md Outdated Show resolved Hide resolved
docs/content/query/schema.md Outdated Show resolved Hide resolved
docs/content/query/schema.md Outdated Show resolved Hide resolved
docs/content/query/schema.md Outdated Show resolved Hide resolved
src/Bridge/AbstractBridge.php Outdated Show resolved Hide resolved
src/Bridge/AbstractBridge.php Outdated Show resolved Hide resolved
src/Platform/Schema/SQLiteSchemaManager.php Show resolved Hide resolved
@pounard pounard force-pushed the no-issue-schema-manager branch 2 times, most recently from e40707d to 239d12e Compare March 1, 2024 16:24
@pounard pounard force-pushed the no-issue-schema-manager branch 2 times, most recently from 63050b0 to 6b18ade Compare March 12, 2024 14:37
Copy link
Member

@SimonMellerin SimonMellerin left a comment

Choose a reason for hiding this comment

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

This API seems really nice to use!

congrats!

docs/content/query/schema.md Outdated Show resolved Hide resolved
docs/content/query/schema.md Outdated Show resolved Hide resolved
docs/content/query/schema.md Outdated Show resolved Hide resolved
docs/content/query/schema.md Outdated Show resolved Hide resolved
docs/content/query/schema.md Show resolved Hide resolved
@pounard pounard force-pushed the no-issue-schema-manager branch from 1379348 to dabaa68 Compare March 12, 2024 15:14
@pounard pounard force-pushed the no-issue-schema-manager branch from 9b48890 to 784f890 Compare March 12, 2024 16:18
@pounard pounard merged commit 4697a6a into main Mar 13, 2024
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants