feat(api): add knex configuration
This commit is contained in:
14
backend/knexfile.js
Normal file
14
backend/knexfile.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
export default {
|
||||||
|
client: 'better-sqlite3',
|
||||||
|
connection: {
|
||||||
|
filename: process.env.DB_PATH || './data/cv.db'
|
||||||
|
},
|
||||||
|
migrations: {
|
||||||
|
directory: './migrations',
|
||||||
|
tableName: 'knex_migrations'
|
||||||
|
},
|
||||||
|
seeds: {
|
||||||
|
directory: './seeds'
|
||||||
|
},
|
||||||
|
useNullAsDefault: true
|
||||||
|
};
|
||||||
24
backend/seeds/initial_cv_data.js
Normal file
24
backend/seeds/initial_cv_data.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
export async function seed(knex) {
|
||||||
|
const existing = await knex('cv_data').where({ id: 1 }).first();
|
||||||
|
|
||||||
|
if (!existing) {
|
||||||
|
await knex('cv_data').insert({
|
||||||
|
id: 1,
|
||||||
|
data: JSON.stringify({
|
||||||
|
personal: {
|
||||||
|
name: "Tuan-Dat Tran",
|
||||||
|
title: "Junior DevOps Engineer",
|
||||||
|
intro: "Passionierter DevOps Engineer mit Fokus auf Cloud-Infrastruktur, Container-Orchestrierung und automatisierte Deployment-Pipelines.",
|
||||||
|
email: "tuan-dat.tran@example.com",
|
||||||
|
github: "https://github.com/tuan-dat-tran",
|
||||||
|
linkedin: "https://linkedin.com/in/tuan-dat-tran",
|
||||||
|
location: "Deutschland"
|
||||||
|
},
|
||||||
|
experience: [],
|
||||||
|
skills: {},
|
||||||
|
education: [],
|
||||||
|
projects: []
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user