Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
38 lines
953 B
Plaintext
38 lines
953 B
Plaintext
export const setColumnID = ({ adapter, columns, fields })=>{
|
|
const idField = fields.find((field)=>field.name === 'id');
|
|
if (idField) {
|
|
if (idField.type === 'number') {
|
|
columns.id = {
|
|
name: 'id',
|
|
type: 'numeric',
|
|
primaryKey: true
|
|
};
|
|
return 'numeric';
|
|
}
|
|
if (idField.type === 'text') {
|
|
columns.id = {
|
|
name: 'id',
|
|
type: 'varchar',
|
|
primaryKey: true
|
|
};
|
|
return 'varchar';
|
|
}
|
|
}
|
|
if (adapter.idType === 'uuid') {
|
|
columns.id = {
|
|
name: 'id',
|
|
type: 'uuid',
|
|
defaultRandom: true,
|
|
primaryKey: true
|
|
};
|
|
return 'uuid';
|
|
}
|
|
columns.id = {
|
|
name: 'id',
|
|
type: 'serial',
|
|
primaryKey: true
|
|
};
|
|
return 'integer';
|
|
};
|
|
|
|
//# sourceMappingURL=setColumnID.js.map |