Skip to content

Commit 751efbb

Browse files
refactor: Enable table primary keys to have other types than int (serverpod#3257)
1 parent a6a3881 commit 751efbb

File tree

165 files changed

+1421
-757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+1421
-757
lines changed

examples/chat/chat_server/lib/src/generated/channel.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import 'package:serverpod/serverpod.dart' as _i1;
1313

1414
/// Represents a chat channel.
15-
abstract class Channel implements _i1.TableRow, _i1.ProtocolSerialization {
15+
abstract class Channel implements _i1.TableRow<int>, _i1.ProtocolSerialization {
1616
Channel._({
1717
this.id,
1818
required this.name,
@@ -47,7 +47,7 @@ abstract class Channel implements _i1.TableRow, _i1.ProtocolSerialization {
4747
String channel;
4848

4949
@override
50-
_i1.Table get table => t;
50+
_i1.Table<int> get table => t;
5151

5252
/// Returns a shallow copy of this [Channel]
5353
/// with some or all fields replaced by the given arguments.
@@ -135,7 +135,7 @@ class _ChannelImpl extends Channel {
135135
}
136136
}
137137

138-
class ChannelTable extends _i1.Table {
138+
class ChannelTable extends _i1.Table<int> {
139139
ChannelTable({super.tableRelation}) : super(tableName: 'channel') {
140140
name = _i1.ColumnString(
141141
'name',
@@ -168,7 +168,7 @@ class ChannelInclude extends _i1.IncludeObject {
168168
Map<String, _i1.Include?> get includes => {};
169169

170170
@override
171-
_i1.Table get table => Channel.t;
171+
_i1.Table<int> get table => Channel.t;
172172
}
173173

174174
class ChannelIncludeList extends _i1.IncludeList {
@@ -188,7 +188,7 @@ class ChannelIncludeList extends _i1.IncludeList {
188188
Map<String, _i1.Include?> get includes => include?.includes ?? {};
189189

190190
@override
191-
_i1.Table get table => Channel.t;
191+
_i1.Table<int> get table => Channel.t;
192192
}
193193

194194
class ChannelRepository {

modules/serverpod_auth/serverpod_auth_server/lib/src/generated/auth_key.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import 'package:serverpod/serverpod.dart' as _i1;
1313

1414
/// Provides a method of access for a user to authenticate with the server.
15-
abstract class AuthKey implements _i1.TableRow, _i1.ProtocolSerialization {
15+
abstract class AuthKey implements _i1.TableRow<int>, _i1.ProtocolSerialization {
1616
AuthKey._({
1717
this.id,
1818
required this.userId,
@@ -68,7 +68,7 @@ abstract class AuthKey implements _i1.TableRow, _i1.ProtocolSerialization {
6868
String method;
6969

7070
@override
71-
_i1.Table get table => t;
71+
_i1.Table<int> get table => t;
7272

7373
/// Returns a shallow copy of this [AuthKey]
7474
/// with some or all fields replaced by the given arguments.
@@ -177,7 +177,7 @@ class _AuthKeyImpl extends AuthKey {
177177
}
178178
}
179179

180-
class AuthKeyTable extends _i1.Table {
180+
class AuthKeyTable extends _i1.Table<int> {
181181
AuthKeyTable({super.tableRelation}) : super(tableName: 'serverpod_auth_key') {
182182
userId = _i1.ColumnInt(
183183
'userId',
@@ -227,7 +227,7 @@ class AuthKeyInclude extends _i1.IncludeObject {
227227
Map<String, _i1.Include?> get includes => {};
228228

229229
@override
230-
_i1.Table get table => AuthKey.t;
230+
_i1.Table<int> get table => AuthKey.t;
231231
}
232232

233233
class AuthKeyIncludeList extends _i1.IncludeList {
@@ -247,7 +247,7 @@ class AuthKeyIncludeList extends _i1.IncludeList {
247247
Map<String, _i1.Include?> get includes => include?.includes ?? {};
248248

249249
@override
250-
_i1.Table get table => AuthKey.t;
250+
_i1.Table<int> get table => AuthKey.t;
251251
}
252252

253253
class AuthKeyRepository {

modules/serverpod_auth/serverpod_auth_server/lib/src/generated/email_auth.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
import 'package:serverpod/serverpod.dart' as _i1;
1313

1414
/// Database bindings for a sign in with email.
15-
abstract class EmailAuth implements _i1.TableRow, _i1.ProtocolSerialization {
15+
abstract class EmailAuth
16+
implements _i1.TableRow<int>, _i1.ProtocolSerialization {
1617
EmailAuth._({
1718
this.id,
1819
required this.userId,
@@ -53,7 +54,7 @@ abstract class EmailAuth implements _i1.TableRow, _i1.ProtocolSerialization {
5354
String hash;
5455

5556
@override
56-
_i1.Table get table => t;
57+
_i1.Table<int> get table => t;
5758

5859
/// Returns a shallow copy of this [EmailAuth]
5960
/// with some or all fields replaced by the given arguments.
@@ -148,7 +149,7 @@ class _EmailAuthImpl extends EmailAuth {
148149
}
149150
}
150151

151-
class EmailAuthTable extends _i1.Table {
152+
class EmailAuthTable extends _i1.Table<int> {
152153
EmailAuthTable({super.tableRelation})
153154
: super(tableName: 'serverpod_email_auth') {
154155
userId = _i1.ColumnInt(
@@ -190,7 +191,7 @@ class EmailAuthInclude extends _i1.IncludeObject {
190191
Map<String, _i1.Include?> get includes => {};
191192

192193
@override
193-
_i1.Table get table => EmailAuth.t;
194+
_i1.Table<int> get table => EmailAuth.t;
194195
}
195196

196197
class EmailAuthIncludeList extends _i1.IncludeList {
@@ -210,7 +211,7 @@ class EmailAuthIncludeList extends _i1.IncludeList {
210211
Map<String, _i1.Include?> get includes => include?.includes ?? {};
211212

212213
@override
213-
_i1.Table get table => EmailAuth.t;
214+
_i1.Table<int> get table => EmailAuth.t;
214215
}
215216

216217
class EmailAuthRepository {

modules/serverpod_auth/serverpod_auth_server/lib/src/generated/email_create_account_request.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import 'package:serverpod/serverpod.dart' as _i1;
1414
/// A request for creating an email signin. Created during the sign up process
1515
/// to keep track of the user's details and verification code.
1616
abstract class EmailCreateAccountRequest
17-
implements _i1.TableRow, _i1.ProtocolSerialization {
17+
implements _i1.TableRow<int>, _i1.ProtocolSerialization {
1818
EmailCreateAccountRequest._({
1919
this.id,
2020
required this.userName,
@@ -62,7 +62,7 @@ abstract class EmailCreateAccountRequest
6262
String verificationCode;
6363

6464
@override
65-
_i1.Table get table => t;
65+
_i1.Table<int> get table => t;
6666

6767
/// Returns a shallow copy of this [EmailCreateAccountRequest]
6868
/// with some or all fields replaced by the given arguments.
@@ -164,7 +164,7 @@ class _EmailCreateAccountRequestImpl extends EmailCreateAccountRequest {
164164
}
165165
}
166166

167-
class EmailCreateAccountRequestTable extends _i1.Table {
167+
class EmailCreateAccountRequestTable extends _i1.Table<int> {
168168
EmailCreateAccountRequestTable({super.tableRelation})
169169
: super(tableName: 'serverpod_email_create_request') {
170170
userName = _i1.ColumnString(
@@ -214,7 +214,7 @@ class EmailCreateAccountRequestInclude extends _i1.IncludeObject {
214214
Map<String, _i1.Include?> get includes => {};
215215

216216
@override
217-
_i1.Table get table => EmailCreateAccountRequest.t;
217+
_i1.Table<int> get table => EmailCreateAccountRequest.t;
218218
}
219219

220220
class EmailCreateAccountRequestIncludeList extends _i1.IncludeList {
@@ -234,7 +234,7 @@ class EmailCreateAccountRequestIncludeList extends _i1.IncludeList {
234234
Map<String, _i1.Include?> get includes => include?.includes ?? {};
235235

236236
@override
237-
_i1.Table get table => EmailCreateAccountRequest.t;
237+
_i1.Table<int> get table => EmailCreateAccountRequest.t;
238238
}
239239

240240
class EmailCreateAccountRequestRepository {

modules/serverpod_auth/serverpod_auth_server/lib/src/generated/email_failed_sign_in.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import 'package:serverpod/serverpod.dart' as _i1;
1414
/// Database table for tracking failed email sign-ins. Saves IP-address, time,
1515
/// and email to be prevent brute force attacks.
1616
abstract class EmailFailedSignIn
17-
implements _i1.TableRow, _i1.ProtocolSerialization {
17+
implements _i1.TableRow<int>, _i1.ProtocolSerialization {
1818
EmailFailedSignIn._({
1919
this.id,
2020
required this.email,
@@ -55,7 +55,7 @@ abstract class EmailFailedSignIn
5555
String ipAddress;
5656

5757
@override
58-
_i1.Table get table => t;
58+
_i1.Table<int> get table => t;
5959

6060
/// Returns a shallow copy of this [EmailFailedSignIn]
6161
/// with some or all fields replaced by the given arguments.
@@ -150,7 +150,7 @@ class _EmailFailedSignInImpl extends EmailFailedSignIn {
150150
}
151151
}
152152

153-
class EmailFailedSignInTable extends _i1.Table {
153+
class EmailFailedSignInTable extends _i1.Table<int> {
154154
EmailFailedSignInTable({super.tableRelation})
155155
: super(tableName: 'serverpod_email_failed_sign_in') {
156156
email = _i1.ColumnString(
@@ -192,7 +192,7 @@ class EmailFailedSignInInclude extends _i1.IncludeObject {
192192
Map<String, _i1.Include?> get includes => {};
193193

194194
@override
195-
_i1.Table get table => EmailFailedSignIn.t;
195+
_i1.Table<int> get table => EmailFailedSignIn.t;
196196
}
197197

198198
class EmailFailedSignInIncludeList extends _i1.IncludeList {
@@ -212,7 +212,7 @@ class EmailFailedSignInIncludeList extends _i1.IncludeList {
212212
Map<String, _i1.Include?> get includes => include?.includes ?? {};
213213

214214
@override
215-
_i1.Table get table => EmailFailedSignIn.t;
215+
_i1.Table<int> get table => EmailFailedSignIn.t;
216216
}
217217

218218
class EmailFailedSignInRepository {

modules/serverpod_auth/serverpod_auth_server/lib/src/generated/email_reset.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
import 'package:serverpod/serverpod.dart' as _i1;
1313

1414
/// Database bindings for an email reset.
15-
abstract class EmailReset implements _i1.TableRow, _i1.ProtocolSerialization {
15+
abstract class EmailReset
16+
implements _i1.TableRow<int>, _i1.ProtocolSerialization {
1617
EmailReset._({
1718
this.id,
1819
required this.userId,
@@ -54,7 +55,7 @@ abstract class EmailReset implements _i1.TableRow, _i1.ProtocolSerialization {
5455
DateTime expiration;
5556

5657
@override
57-
_i1.Table get table => t;
58+
_i1.Table<int> get table => t;
5859

5960
/// Returns a shallow copy of this [EmailReset]
6061
/// with some or all fields replaced by the given arguments.
@@ -149,7 +150,7 @@ class _EmailResetImpl extends EmailReset {
149150
}
150151
}
151152

152-
class EmailResetTable extends _i1.Table {
153+
class EmailResetTable extends _i1.Table<int> {
153154
EmailResetTable({super.tableRelation})
154155
: super(tableName: 'serverpod_email_reset') {
155156
userId = _i1.ColumnInt(
@@ -191,7 +192,7 @@ class EmailResetInclude extends _i1.IncludeObject {
191192
Map<String, _i1.Include?> get includes => {};
192193

193194
@override
194-
_i1.Table get table => EmailReset.t;
195+
_i1.Table<int> get table => EmailReset.t;
195196
}
196197

197198
class EmailResetIncludeList extends _i1.IncludeList {
@@ -211,7 +212,7 @@ class EmailResetIncludeList extends _i1.IncludeList {
211212
Map<String, _i1.Include?> get includes => include?.includes ?? {};
212213

213214
@override
214-
_i1.Table get table => EmailReset.t;
215+
_i1.Table<int> get table => EmailReset.t;
215216
}
216217

217218
class EmailResetRepository {

modules/serverpod_auth/serverpod_auth_server/lib/src/generated/google_refresh_token.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import 'package:serverpod/serverpod.dart' as _i1;
1313

1414
/// Database bindings for a Google refresh token.
1515
abstract class GoogleRefreshToken
16-
implements _i1.TableRow, _i1.ProtocolSerialization {
16+
implements _i1.TableRow<int>, _i1.ProtocolSerialization {
1717
GoogleRefreshToken._({
1818
this.id,
1919
required this.userId,
@@ -48,7 +48,7 @@ abstract class GoogleRefreshToken
4848
String refreshToken;
4949

5050
@override
51-
_i1.Table get table => t;
51+
_i1.Table<int> get table => t;
5252

5353
/// Returns a shallow copy of this [GoogleRefreshToken]
5454
/// with some or all fields replaced by the given arguments.
@@ -136,7 +136,7 @@ class _GoogleRefreshTokenImpl extends GoogleRefreshToken {
136136
}
137137
}
138138

139-
class GoogleRefreshTokenTable extends _i1.Table {
139+
class GoogleRefreshTokenTable extends _i1.Table<int> {
140140
GoogleRefreshTokenTable({super.tableRelation})
141141
: super(tableName: 'serverpod_google_refresh_token') {
142142
userId = _i1.ColumnInt(
@@ -170,7 +170,7 @@ class GoogleRefreshTokenInclude extends _i1.IncludeObject {
170170
Map<String, _i1.Include?> get includes => {};
171171

172172
@override
173-
_i1.Table get table => GoogleRefreshToken.t;
173+
_i1.Table<int> get table => GoogleRefreshToken.t;
174174
}
175175

176176
class GoogleRefreshTokenIncludeList extends _i1.IncludeList {
@@ -190,7 +190,7 @@ class GoogleRefreshTokenIncludeList extends _i1.IncludeList {
190190
Map<String, _i1.Include?> get includes => include?.includes ?? {};
191191

192192
@override
193-
_i1.Table get table => GoogleRefreshToken.t;
193+
_i1.Table<int> get table => GoogleRefreshToken.t;
194194
}
195195

196196
class GoogleRefreshTokenRepository {

modules/serverpod_auth/serverpod_auth_server/lib/src/generated/user_image.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
import 'package:serverpod/serverpod.dart' as _i1;
1313

1414
/// Database bindings for a user image.
15-
abstract class UserImage implements _i1.TableRow, _i1.ProtocolSerialization {
15+
abstract class UserImage
16+
implements _i1.TableRow<int>, _i1.ProtocolSerialization {
1617
UserImage._({
1718
this.id,
1819
required this.userId,
@@ -53,7 +54,7 @@ abstract class UserImage implements _i1.TableRow, _i1.ProtocolSerialization {
5354
String url;
5455

5556
@override
56-
_i1.Table get table => t;
57+
_i1.Table<int> get table => t;
5758

5859
/// Returns a shallow copy of this [UserImage]
5960
/// with some or all fields replaced by the given arguments.
@@ -148,7 +149,7 @@ class _UserImageImpl extends UserImage {
148149
}
149150
}
150151

151-
class UserImageTable extends _i1.Table {
152+
class UserImageTable extends _i1.Table<int> {
152153
UserImageTable({super.tableRelation})
153154
: super(tableName: 'serverpod_user_image') {
154155
userId = _i1.ColumnInt(
@@ -190,7 +191,7 @@ class UserImageInclude extends _i1.IncludeObject {
190191
Map<String, _i1.Include?> get includes => {};
191192

192193
@override
193-
_i1.Table get table => UserImage.t;
194+
_i1.Table<int> get table => UserImage.t;
194195
}
195196

196197
class UserImageIncludeList extends _i1.IncludeList {
@@ -210,7 +211,7 @@ class UserImageIncludeList extends _i1.IncludeList {
210211
Map<String, _i1.Include?> get includes => include?.includes ?? {};
211212

212213
@override
213-
_i1.Table get table => UserImage.t;
214+
_i1.Table<int> get table => UserImage.t;
214215
}
215216

216217
class UserImageRepository {

0 commit comments

Comments
 (0)