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
42 lines
1.2 KiB
Plaintext
42 lines
1.2 KiB
Plaintext
import { buildDrizzleRelations } from '../schema/buildDrizzleRelations.js';
|
|
import { buildRawSchema } from '../schema/buildRawSchema.js';
|
|
import { executeSchemaHooks } from '../utilities/executeSchemaHooks.js';
|
|
import { buildDrizzleTable } from './schema/buildDrizzleTable.js';
|
|
import { setColumnID } from './schema/setColumnID.js';
|
|
export const init = async function init() {
|
|
let locales;
|
|
this.rawRelations = {};
|
|
this.rawTables = {};
|
|
if (this.payload.config.localization) {
|
|
locales = this.payload.config.localization.locales.map(({ code })=>code);
|
|
}
|
|
const adapter = this;
|
|
buildRawSchema({
|
|
adapter,
|
|
setColumnID
|
|
});
|
|
await executeSchemaHooks({
|
|
type: 'beforeSchemaInit',
|
|
adapter: this
|
|
});
|
|
for(const tableName in this.rawTables){
|
|
buildDrizzleTable({
|
|
adapter,
|
|
locales,
|
|
rawTable: this.rawTables[tableName]
|
|
});
|
|
}
|
|
buildDrizzleRelations({
|
|
adapter
|
|
});
|
|
await executeSchemaHooks({
|
|
type: 'afterSchemaInit',
|
|
adapter: this
|
|
});
|
|
this.schema = {
|
|
...this.tables,
|
|
...this.relations
|
|
};
|
|
};
|
|
|
|
//# sourceMappingURL=init.js.map |