@@ -120,9 +120,9 @@ public TableMap MapTable<T>() {
120
120
/// For example, passing "fts5" creates a virtual table using <see href="https://www.sql-easy.com/learn/sqlite-full-text-search">Full Text Search v5</see>.
121
121
/// </summary>
122
122
/// <returns>
123
- /// Whether the table was created or migrated.
123
+ /// <see langword="true"/> if the table was created, <see langword="false"/> if it was migrated.
124
124
/// </returns>
125
- public CreateTableResult CreateTable ( Type type , string ? virtualModuleName = null ) {
125
+ public bool CreateTable ( Type type , string ? virtualModuleName = null ) {
126
126
TableMap map = MapTable ( type ) ;
127
127
128
128
// Ensure table has at least one column
@@ -131,11 +131,12 @@ public CreateTableResult CreateTable(Type type, string? virtualModuleName = null
131
131
}
132
132
133
133
// Check if the table already exists
134
- CreateTableResult result = CreateTableResult . Created ;
134
+ bool created ;
135
135
List < ColumnInfo > existingColumns = GetColumnInfos ( map . TableName ) . ToList ( ) ;
136
136
137
137
// Create new table
138
138
if ( existingColumns . Count == 0 ) {
139
+ created = true ;
139
140
// Add virtual table modifiers
140
141
string virtualModifier = virtualModuleName is not null ? "virtual" : "" ;
141
142
string usingModifier = virtualModuleName is not null ? $ "using { Quote ( virtualModuleName ) } " : "" ;
@@ -153,7 +154,7 @@ public CreateTableResult CreateTable(Type type, string? virtualModuleName = null
153
154
}
154
155
// Migrate existing table
155
156
else {
156
- result = CreateTableResult . Migrated ;
157
+ created = false ;
157
158
MigrateTable ( map ) ;
158
159
}
159
160
@@ -184,21 +185,21 @@ public CreateTableResult CreateTable(Type type, string? virtualModuleName = null
184
185
CreateIndex ( index . IndexName , index . TableName , index . Columns , index . Unique ) ;
185
186
}
186
187
187
- return result ;
188
+ return created ;
188
189
}
189
190
/// <inheritdoc cref="CreateTable(Type, string?)"/>
190
- public CreateTableResult CreateTable < T > ( string ? virtualModuleName = null ) {
191
+ public bool CreateTable < T > ( string ? virtualModuleName = null ) {
191
192
return CreateTable ( typeof ( T ) , virtualModuleName ) ;
192
193
}
193
194
/// <summary>
194
195
/// Creates tables for the given types if they don't already exist.<br/>
195
196
/// Indexes are also created for columns with <see cref="IndexedAttribute"/>.
196
197
/// </summary>
197
198
/// <returns>
198
- /// Whether the tables were created or migrated.
199
+ /// <see langword="true"/> if the tables were created, <see langword="false"/> if they were migrated.
199
200
/// </returns>
200
- public Dictionary < Type , CreateTableResult > CreateTables ( IEnumerable < Type > types ) {
201
- Dictionary < Type , CreateTableResult > results = [ ] ;
201
+ public Dictionary < Type , bool > CreateTables ( IEnumerable < Type > types ) {
202
+ Dictionary < Type , bool > results = [ ] ;
202
203
foreach ( Type type in types ) {
203
204
results [ type ] = CreateTable ( type ) ;
204
205
}
@@ -808,15 +809,15 @@ public Task<TableMap> GetMappingAsync(Type type) {
808
809
return Task . Run ( ( ) => MapTable < T > ( ) ) ;
809
810
}
810
811
/// <inheritdoc cref="CreateTable(Type, string?)"/>
811
- public Task < CreateTableResult > CreateTableAsync ( Type type , string ? virtualModuleName = null ) {
812
+ public Task < bool > CreateTableAsync ( Type type , string ? virtualModuleName = null ) {
812
813
return Task . Run ( ( ) => CreateTable ( type , virtualModuleName ) ) ;
813
814
}
814
815
/// <inheritdoc cref="CreateTable{T}(string?)"/>
815
- public Task < CreateTableResult > CreateTableAsync < T > ( string ? virtualModuleName = null ) where T : new ( ) {
816
+ public Task < bool > CreateTableAsync < T > ( string ? virtualModuleName = null ) where T : new ( ) {
816
817
return Task . Run ( ( ) => CreateTable < T > ( virtualModuleName ) ) ;
817
818
}
818
819
/// <inheritdoc cref="CreateTables(IEnumerable{Type})"/>
819
- public Task < Dictionary < Type , CreateTableResult > > CreateTablesAsync ( IEnumerable < Type > types ) {
820
+ public Task < Dictionary < Type , bool > > CreateTablesAsync ( IEnumerable < Type > types ) {
820
821
return Task . Run ( ( ) => CreateTables ( types ) ) ;
821
822
}
822
823
/// <inheritdoc cref="DropTable{T}()"/>
0 commit comments