Initial Commit
Commit pertama, memindahkan repository dari github ke gitea.
This commit is contained in:
commit
13a47fbebf
41 files changed
+12327
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import mysql from 'mysql2/promise';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
async function main() {
|
||||
console.log('Migrating MySQL database aghatis_studio_db...');
|
||||
const connection = await mysql.createConnection({
|
||||
host: '103.155.224.244',
|
||||
user: 'root',
|
||||
password: 'hqn9OY2pJx1oYRYJoVrC0Q64sZj8k3W3ZpoVcsKAmv1DFqO9u0DIMGCkjjXEjLaB',
|
||||
database: 'aghatis_studio_db',
|
||||
multipleStatements: true,
|
||||
});
|
||||
|
||||
const sql = fs.readFileSync('database/schema.sql', 'utf8');
|
||||
|
||||
// Remove comment lines starting with --
|
||||
const cleanSql = sql
|
||||
.split('\n')
|
||||
.filter(line => !line.trim().startsWith('--'))
|
||||
.join('\n');
|
||||
|
||||
console.log('Executing SQL schema and seeds...');
|
||||
await connection.query(cleanSql);
|
||||
console.log('Migration completed successfully!');
|
||||
|
||||
const [tracks] = await connection.query('SELECT id, title FROM tracks');
|
||||
console.log('Tracks in DB:', tracks);
|
||||
|
||||
const [projects] = await connection.query('SELECT id, title, category, status FROM projects');
|
||||
console.log('Projects in DB:', projects);
|
||||
|
||||
await connection.end();
|
||||
}
|
||||
|
||||
main().catch(err => {
|
||||
console.error('Migration error:', err);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in new issue
Block a user