freeschema 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/freeschema.js
CHANGED
|
@@ -212,6 +212,11 @@ const COMPOSE_PATCHES = [
|
|
|
212
212
|
replace: '$1 user: "1883:1883"\n',
|
|
213
213
|
label: 'mosquitto user (1883:1883 to skip chown on Windows)',
|
|
214
214
|
},
|
|
215
|
+
{
|
|
216
|
+
find: /(--default-authentication-plugin=mysql_native_password)(?!\s*\n\s*--log-bin-trust)/,
|
|
217
|
+
replace: '$1\n --log-bin-trust-function-creators=1',
|
|
218
|
+
label: 'MySQL log_bin_trust_function_creators (allows stored functions/triggers)',
|
|
219
|
+
},
|
|
215
220
|
];
|
|
216
221
|
|
|
217
222
|
function patchComposeFile() {
|
|
@@ -537,13 +542,14 @@ function cmdStart() {
|
|
|
537
542
|
const env = readEnv();
|
|
538
543
|
const dbUser = env.DB_USER || env.MYSQL_USER || 'freeschema';
|
|
539
544
|
const dbPass = env.DB_PASSWORD || env.MYSQL_PASSWORD || 'Freeschema@123';
|
|
545
|
+
const rootPass = env.MYSQL_ROOT_PASSWORD || ('Admin@' + dbPass);
|
|
540
546
|
const dbName = env.DB_DATABASE || 'freeschema_db';
|
|
541
547
|
const container = getMysqlContainer();
|
|
542
548
|
if (!waitForMySQL(container, dbUser, dbPass)) die('MySQL did not become ready — check logs with `freeschema logs mysql-server`.');
|
|
543
549
|
console.log(` Seeding ${dbName} from ${seedFile}…`);
|
|
544
550
|
const result = spawnSync(
|
|
545
551
|
'docker',
|
|
546
|
-
['exec', '-i', container, 'mysql',
|
|
552
|
+
['exec', '-i', container, 'mysql', '-uroot', `-p${rootPass}`, dbName],
|
|
547
553
|
{ input: fs.readFileSync(seedFile), stdio: ['pipe', 'inherit', 'inherit'] }
|
|
548
554
|
);
|
|
549
555
|
if (result.error || result.status !== 0) die('Seed failed — check container logs.');
|
|
@@ -680,15 +686,15 @@ function cmdDbRestore() {
|
|
|
680
686
|
if (!fs.existsSync(sqlFile)) die(`File not found: ${sqlFile}`);
|
|
681
687
|
|
|
682
688
|
const env = readEnv();
|
|
683
|
-
const dbUser = env.DB_USER || env.MYSQL_USER || 'freeschema';
|
|
684
689
|
const dbPass = env.DB_PASSWORD || env.MYSQL_PASSWORD || 'Freeschema@123';
|
|
690
|
+
const rootPass = env.MYSQL_ROOT_PASSWORD || ('Admin@' + dbPass);
|
|
685
691
|
const dbName = env.DB_DATABASE || 'freeschema_db';
|
|
686
692
|
const container = getMysqlContainer();
|
|
687
693
|
|
|
688
694
|
console.log(`Restoring ${sqlFile} → ${dbName}…`);
|
|
689
695
|
const result = spawnSync(
|
|
690
696
|
'docker',
|
|
691
|
-
['exec', '-i', container, 'mysql',
|
|
697
|
+
['exec', '-i', container, 'mysql', '-uroot', `-p${rootPass}`, dbName],
|
|
692
698
|
{ input: fs.readFileSync(sqlFile), stdio: ['pipe', 'inherit', 'inherit'] }
|
|
693
699
|
);
|
|
694
700
|
if (result.error || result.status !== 0) die('Restore failed — check container logs.');
|
package/package.json
CHANGED
|
@@ -39,6 +39,7 @@ services:
|
|
|
39
39
|
user: "999:999"
|
|
40
40
|
command: >
|
|
41
41
|
--default-authentication-plugin=mysql_native_password
|
|
42
|
+
--log-bin-trust-function-creators=1
|
|
42
43
|
healthcheck:
|
|
43
44
|
test: ["CMD-SHELL", "mysqladmin ping -h localhost -u${MYSQL_USER:-freeschema} -p${MYSQL_PASSWORD:-Freeschema@123} --silent"]
|
|
44
45
|
interval: 10s
|