Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/_src/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,13 @@ def page(group, slug, title, summary, *sections, source="src/Migrator/Framework/
Database.Delete("Users", new[] { "Id" }, new object[] { 1 });
''', '''
migration.Delete.FromTable("Users").Where(new[] { "Id" }, new object[] { 1 });
''')),
section("Delete duplicate rows", '<p>DeleteDuplicateRows keeps one arbitrary row per composite key using database equality and collation. It supports SQLite ordinary rowid tables, PostgreSQL, Oracle ROWID tables and SQL Server. NULL keys compare equal by default; pass DuplicateNullHandling.ExcludeNullKeys to leave rows with any NULL key untouched. The direct API returns the database-reported affected-row count. Non-key values do not influence the survivor. Keys must be non-empty, distinct existing columns.</p><p>The operation executes one DELETE in the existing transaction without changing the schema. Normal DELETE triggers and foreign-key rules apply. It does not prevent concurrent or future duplicates: coordinate writers and add an appropriate unique constraint separately. Deleted data cannot be automatically reversed. SQL preview is unsupported because safe physical row identity selection requires live metadata. Unsupported providers and SQLite tables without an accessible rowid are rejected.</p>', pair("Keep one assignment per role/group pair", '''
int removed = Database.DeleteDuplicateRows("Assignments",
new[] { "RoleId", "GroupId" }, DuplicateRowRetention.Any);
''', '''
migration.Delete.DuplicateRows().FromTable("Assignments")
.ByColumns("RoleId", "GroupId").KeepAny();
''')),
section("Conditional seed data", '<p>Use an explicit identifying predicate when a seed should exist only once. This is distinct from a migration version: a named profile can run repeatedly without a history entry. Coordinate competing writers; a check-then-insert helper is not a substitute for a database unique key.</p>', pair("Insert a missing seed", '''
Database.InsertIfNotExists("Users", new[] { "Id", "Name" },
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/search-index.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/fluent-operation-coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"AddTable": "Create.Table(...).WithFields(...) / WithEngine(...)",
"AddColumn": "Create.Column(name).OnTable(table).OfType(...) / Create.Column(definition).OnTable(table); Database.AddColumn(table, column, primaryKey) for the combined operation",
"RemoveUniqueConstraint": "Database.RemoveUniqueConstraint(table, definition) for exact metadata-based selection, including unnamed SQLite constraints",
"DeleteDuplicateRows": "Delete.DuplicateRows().FromTable(table).ByColumns(...).KeepAny(nulls)",
"ChangeColumn": "Alter.Column(name).OnTable(table).OfType(...) / Alter.Column(definition).OnTable(table)",
"AddPrimaryKey": "Create.PrimaryKey(name).OnTable(table).WithColumns(...)",
"AddPrimaryKeyNonClustered": "Create.NonClusteredPrimaryKey(name).OnTable(table).WithColumns(...)",
Expand Down
Loading
Loading