forked from uptrace/bun
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* 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
feat: Enhance Apply method to accept multiple functions
MySQL/MariaDB: add support for ORDER BY and LIMIT clauses in UPDATE/DELETE statements
Signed-off-by: Kursat Aktas <[email protected]>
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
AutoMigrate for Postgres dialect
MariaDB: add support for RETURNING clause in DELETE statements
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 : )