@@ -205,16 +205,38 @@ db.DeleteById<User>(1, 2, 3);
205
205
You can use the following methods to create and drop parts of your database:
206
206
207
207
``` csharp
208
+ // tables
209
+ db .CreateTable <User >();
210
+ db .CreateTables (typeof (User ), typeof (Address ));
211
+
208
212
db .CreateTableIfNotExists <User >();
213
+ db .CreateTablesIfNotExists (typeof (User ), typeof (Address ));
214
+
215
+ db .DropTable <User >();
216
+ db .DropTables (typeof (User ), typeof (Address ));
217
+
209
218
db .DropTableIfExists <User >();
219
+ db .DropTablesIfExists (typeof (User ), typeof (Address ));
210
220
221
+ // columns
222
+ db .CreateColumn <User >(t => t .NewColumn );
211
223
db .CreateColumnIfNotExists <User >(t => t .NewColumn );
224
+
225
+ db .DropColumn <User >(t => t .NewColumn );
212
226
db .DropColumnIfExists <User >(t => t .NewColumn );
213
227
228
+ // indexes
229
+ db .CreateIndex <User >(t => new { t .Id , t .Name }, true , " IX_User_IdName_Unique" );
214
230
db .CreateIndexIfNotExists <User >(t => new { t .Id , t .Name }, true , " IX_User_IdName_Unique" );
231
+
232
+ db .DropIndex <User >(" IX_User_IdName_Unique" );
215
233
db .DropIndexIfExists <User >(" IX_User_IdName_Unique" );
216
234
235
+ // foreign keys
236
+ db .CreateForeignKey <User , Address >(u => u .Id , a => a .UserId , " FK_User_Address" );
217
237
db .CreateForeignKeyIfNotExists <User , Address >(u => u .Id , a => a .UserId , " FK_User_Address" );
238
+
239
+ db .DropForeignKey <User >(" FK_User_Address" );
218
240
db .DropForeignKeyIfExists <User >(" FK_User_Address" );
219
241
```
220
242
0 commit comments