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

[pull] master from uptrace:master #81

Merged
merged 80 commits into from
Nov 17, 2024
Merged

Conversation

pull[bot]
Copy link

@pull pull bot commented Nov 17, 2024

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

Aoang and others added 30 commits October 27, 2024 12:24
* feat(schema): add support type for net/netip.Addr and net/netip.Prefix

* fix(schema): net.IPNet(not ptr) is not implement fmt.Stringer

Edit: updated commit message to comply with commitlint [subject-case] rule.
Original subject: "Add support type..."
- RawQuery
- CreateTableQuery
Additionally:
- allow custom FK names (limited applicability rn)
- implement GetReverse for AddFK and DropFK
- detect renamed foreign keys
- EqualSignature handles empty models (no columns)
This is a WIP commit.
- Do not implement AppendQuery on Operation level.
This is a leaky abstraction as queries are dialect-specific
and migrate package should not be concerned with how they are constructed.
- AlterTableQuery also is an unnecessary abstraction.
Now pgdialect will just build a simple string-query for each Operation.
- Moved operations.go to migrate/ package and deleted alt/ package.
- Minor clean-ups and documentation.

testChangeColumnType is commented out because the implementation is missing.
Bufixes and improvements:
- pgdialect.Inspector canonicalizes all default expressions (lowercase)
to make sure they are always comparable with the model definition.
- sqlschema.SchemaInspector canonicalizes all default expressions (lowercase)
- pgdialect and sqlschema now support type-equivalence, which prevents unnecessary
migrations like CHAR -> CHARACTER from being created.

Changing PRIMARY KEY and UNIQUE-ness are outside of this commit's scope, because
those constraints can span multiple columns.
FYI, identity is independent of primary keys and vice versa.
It is only a method of generating new values for a column.
Can be created and dropped in any order, as long as
the column to add it to is declared NOT NULL
- New operations: AddColumn and DropColumn
- Fixed cmpColumns to find 'extra' columns
- Refactored alter query builder in pgdialect
Each dialect has to type-switch the operation before building a query for it.
Since the migrator knows the concrete type of each operation, they are free
to provide FQN in any form. Using schema.FQN field from the start simplifies
the data structure later.

Empty inteface is better that a superficial one.
Database inspector no longer mixes UNIQUE constraints with
other constraint types, such as PK and FKs. While database
drivers may require some FK and PK fields to be unique,
these constraints are in practice distinct UNIQUE constraints
and should not be synonymous to PK/FK constraints.

Changes in UNIQUE constraints can be detected in any tables
that haven't been dropped.
BaseFields -> BasePKs and JoinFields -> JoinPKs were updated in
8648d6f
- Retrieve PK information on the table level rather than
for each column individually.
- Refine dependencies between migrations
bevzzz and others added 28 commits November 8, 2024 01:05
feat: Enhance Apply method to accept multiple functions
MySQL/MariaDB: add support for ORDER BY and LIMIT clauses in UPDATE/DELETE statements
AutoMigrator only supports 1 schema at a time.
Use WithSchemaName() option to configure it.
Defaults to the default schema in the dialect.
Now that AutoMigrator only works with one schema at a time, there's no need to keep
the code which was used ot differentiate tables between schemas
MariaDB: add support for RETURNING clause in DELETE statements
@pull pull bot added the ⤵️ pull label Nov 17, 2024
@pull pull bot merged commit 4fcf18a into annihilatorrrr:master Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants