@@ -18,6 +18,7 @@ define(null, {
18
18
this . __identifierInputMethod = isUndefined ( opts . identifierInputMethod ) ? isUndefined ( statics . identifierInputMethod ) ? this . identifierInputMethodDefault : statics . identifierInputMethod : opts . identifierInputMethod ;
19
19
this . __identifierOutputMethod = isUndefined ( opts . identifierOutputMethod ) ? isUndefined ( statics . identifierOutputMethod ) ? this . identifierOutputMethodDefault : statics . identifierOutputMethod : opts . identifierOutputMethod ;
20
20
this . __quoteIdentifiers = isUndefined ( opts . quoteIdentifiers ) ? isUndefinedOrNull ( statics . quoteIdentifiers ) ? this . quoteIdentifiersDefault : statics . quoteIdentifiers : opts . quoteIdentifiers ;
21
+ this . __defaultPrimaryKeyType = isUndefined ( opts . defaultPrimaryKeyType ) ? ( isUndefinedOrNull ( statics . defaultPrimaryKeyType ) ? this . defaultPrimaryKeyTypeDefault : statics . defaultPrimaryKeyType ) : opts . defaultPrimaryKeyType ;
21
22
} ,
22
23
23
24
getters :{
@@ -41,6 +42,17 @@ define(null, {
41
42
return null ;
42
43
} ,
43
44
45
+ /**
46
+ * Default type for primary/foreign keys when a type is not specified.
47
+ *
48
+ * @field
49
+ * @type String
50
+ * @default "integer"
51
+ */
52
+ defaultPrimaryKeyTypeDefault :function ( ) {
53
+ return "integer" ;
54
+ } ,
55
+
44
56
/**
45
57
* The default String or comb method to use transform identifiers with when
46
58
* sending identifiers to the database.
@@ -74,6 +86,17 @@ define(null, {
74
86
return true ;
75
87
} ,
76
88
89
+ /**
90
+ * Default type for primary/foreign keys when a type is not specified.
91
+ *
92
+ * @field
93
+ * @type String
94
+ * @default "integer"
95
+ */
96
+ defaultPrimaryKeyType :function ( ) {
97
+ return this . __defaultPrimaryKeyType ;
98
+ } ,
99
+
77
100
/**
78
101
* Default serial primary key options, used by the table creation
79
102
* code.
@@ -82,7 +105,11 @@ define(null, {
82
105
* @default {primaryKey : true, type : "integer", autoIncrement : true}
83
106
* */
84
107
serialPrimaryKeyOptions :function ( ) {
85
- return { primaryKey :true , type :"integer" , autoIncrement :true } ;
108
+ return {
109
+ primaryKey :true ,
110
+ type : this . defaultPrimaryKeyType ,
111
+ autoIncrement :true
112
+ } ;
86
113
} ,
87
114
88
115
/**
@@ -178,6 +205,10 @@ define(null, {
178
205
179
206
supportsSavepoints :function ( supports ) {
180
207
this . __supportsSavePoints = supports ;
208
+ } ,
209
+
210
+ defaultPrimaryKeyType :function ( type ) {
211
+ this . __defaultPrimaryKeyType = type ;
181
212
}
182
213
}
183
214
} ,
@@ -190,6 +221,8 @@ define(null, {
190
221
191
222
__quoteIdentifiers :null ,
192
223
224
+ __defaultPrimaryKeyType :undefined ,
225
+
193
226
getters :{
194
227
/**@lends patio.Database*/
195
228
@@ -224,6 +257,16 @@ define(null, {
224
257
*/
225
258
quoteIdentifiers :function ( ) {
226
259
return this . __quoteIdentifiers ;
260
+ } ,
261
+
262
+ /**
263
+ * The default type for primary keys if no type is specified.
264
+ * @ignore
265
+ * @type String
266
+ * Returns the default primary key type for schema migrations.
267
+ */
268
+ defaultPrimaryKeyType :function ( ) {
269
+ return this . __defaultPrimaryKeyType ;
227
270
}
228
271
} ,
229
272
@@ -238,6 +281,10 @@ define(null, {
238
281
239
282
quoteIdentifiers :function ( quoteIdentifiers ) {
240
283
this . __quoteIdentifiers = quoteIdentifiers ;
284
+ } ,
285
+
286
+ defaultPrimaryKeyType :function ( type ) {
287
+ this . __defaultPrimaryKeyType = type ;
241
288
}
242
289
}
243
290
}
0 commit comments